~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/of_address.h

Version: ~ [ linux-5.3-rc5 ] ~ [ linux-5.2.9 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.67 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.139 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.189 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.189 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.72 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef __OF_ADDRESS_H
  2 #define __OF_ADDRESS_H
  3 #include <linux/ioport.h>
  4 #include <linux/errno.h>
  5 #include <linux/of.h>
  6 #include <linux/io.h>
  7 
  8 struct of_pci_range_parser {
  9         struct device_node *node;
 10         const __be32 *range;
 11         const __be32 *end;
 12         int np;
 13         int pna;
 14 };
 15 
 16 struct of_pci_range {
 17         u32 pci_space;
 18         u64 pci_addr;
 19         u64 cpu_addr;
 20         u64 size;
 21         u32 flags;
 22 };
 23 
 24 #define for_each_of_pci_range(parser, range) \
 25         for (; of_pci_range_parser_one(parser, range);)
 26 
 27 /* Translate a DMA address from device space to CPU space */
 28 extern u64 of_translate_dma_address(struct device_node *dev,
 29                                     const __be32 *in_addr);
 30 
 31 #ifdef CONFIG_OF_ADDRESS
 32 extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
 33 extern int of_address_to_resource(struct device_node *dev, int index,
 34                                   struct resource *r);
 35 extern struct device_node *of_find_matching_node_by_address(
 36                                         struct device_node *from,
 37                                         const struct of_device_id *matches,
 38                                         u64 base_address);
 39 extern void __iomem *of_iomap(struct device_node *device, int index);
 40 void __iomem *of_io_request_and_map(struct device_node *device,
 41                                     int index, const char *name);
 42 
 43 /* Extract an address from a device, returns the region size and
 44  * the address space flags too. The PCI version uses a BAR number
 45  * instead of an absolute index
 46  */
 47 extern const __be32 *of_get_address(struct device_node *dev, int index,
 48                            u64 *size, unsigned int *flags);
 49 
 50 extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
 51                         struct device_node *node);
 52 extern struct of_pci_range *of_pci_range_parser_one(
 53                                         struct of_pci_range_parser *parser,
 54                                         struct of_pci_range *range);
 55 extern int of_dma_get_range(struct device_node *np, u64 *dma_addr,
 56                                 u64 *paddr, u64 *size);
 57 extern bool of_dma_is_coherent(struct device_node *np);
 58 #else /* CONFIG_OF_ADDRESS */
 59 static inline void __iomem *of_io_request_and_map(struct device_node *device,
 60                                                   int index, const char *name)
 61 {
 62         return IOMEM_ERR_PTR(-EINVAL);
 63 }
 64 
 65 static inline u64 of_translate_address(struct device_node *np,
 66                                        const __be32 *addr)
 67 {
 68         return OF_BAD_ADDR;
 69 }
 70 
 71 static inline struct device_node *of_find_matching_node_by_address(
 72                                         struct device_node *from,
 73                                         const struct of_device_id *matches,
 74                                         u64 base_address)
 75 {
 76         return NULL;
 77 }
 78 
 79 static inline const __be32 *of_get_address(struct device_node *dev, int index,
 80                                         u64 *size, unsigned int *flags)
 81 {
 82         return NULL;
 83 }
 84 
 85 static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,
 86                         struct device_node *node)
 87 {
 88         return -1;
 89 }
 90 
 91 static inline struct of_pci_range *of_pci_range_parser_one(
 92                                         struct of_pci_range_parser *parser,
 93                                         struct of_pci_range *range)
 94 {
 95         return NULL;
 96 }
 97 
 98 static inline int of_dma_get_range(struct device_node *np, u64 *dma_addr,
 99                                 u64 *paddr, u64 *size)
100 {
101         return -ENODEV;
102 }
103 
104 static inline bool of_dma_is_coherent(struct device_node *np)
105 {
106         return false;
107 }
108 #endif /* CONFIG_OF_ADDRESS */
109 
110 #ifdef CONFIG_OF
111 extern int of_address_to_resource(struct device_node *dev, int index,
112                                   struct resource *r);
113 void __iomem *of_iomap(struct device_node *node, int index);
114 #else
115 static inline int of_address_to_resource(struct device_node *dev, int index,
116                                          struct resource *r)
117 {
118         return -EINVAL;
119 }
120 
121 static inline void __iomem *of_iomap(struct device_node *device, int index)
122 {
123         return NULL;
124 }
125 #endif
126 
127 #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
128 extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
129                                u64 *size, unsigned int *flags);
130 extern int of_pci_address_to_resource(struct device_node *dev, int bar,
131                                       struct resource *r);
132 extern int of_pci_range_to_resource(struct of_pci_range *range,
133                                     struct device_node *np,
134                                     struct resource *res);
135 #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
136 static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
137                                              struct resource *r)
138 {
139         return -ENOSYS;
140 }
141 
142 static inline const __be32 *of_get_pci_address(struct device_node *dev,
143                 int bar_no, u64 *size, unsigned int *flags)
144 {
145         return NULL;
146 }
147 static inline int of_pci_range_to_resource(struct of_pci_range *range,
148                                            struct device_node *np,
149                                            struct resource *res)
150 {
151         return -ENOSYS;
152 }
153 #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
154 
155 #endif /* __OF_ADDRESS_H */
156 
157 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp