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

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

Version: ~ [ linux-5.9-rc5 ] ~ [ linux-5.8.10 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.66 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.146 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.198 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.236 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.236 ] ~ [ 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.85 ] ~ [ 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-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 
  7 struct of_pci_range_parser {
  8         struct device_node *node;
  9         const __be32 *range;
 10         const __be32 *end;
 11         int np;
 12         int pna;
 13 };
 14 
 15 struct of_pci_range {
 16         u32 pci_space;
 17         u64 pci_addr;
 18         u64 cpu_addr;
 19         u64 size;
 20         u32 flags;
 21 };
 22 
 23 #define for_each_of_pci_range(parser, range) \
 24         for (; of_pci_range_parser_one(parser, range);)
 25 
 26 static inline void of_pci_range_to_resource(struct of_pci_range *range,
 27                                             struct device_node *np,
 28                                             struct resource *res)
 29 {
 30         res->flags = range->flags;
 31         res->start = range->cpu_addr;
 32         res->end = range->cpu_addr + range->size - 1;
 33         res->parent = res->child = res->sibling = NULL;
 34         res->name = np->full_name;
 35 }
 36 
 37 /* Translate a DMA address from device space to CPU space */
 38 extern u64 of_translate_dma_address(struct device_node *dev,
 39                                     const __be32 *in_addr);
 40 
 41 #ifdef CONFIG_OF_ADDRESS
 42 extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
 43 extern bool of_can_translate_address(struct device_node *dev);
 44 extern int of_address_to_resource(struct device_node *dev, int index,
 45                                   struct resource *r);
 46 extern struct device_node *of_find_matching_node_by_address(
 47                                         struct device_node *from,
 48                                         const struct of_device_id *matches,
 49                                         u64 base_address);
 50 extern void __iomem *of_iomap(struct device_node *device, int index);
 51 
 52 /* Extract an address from a device, returns the region size and
 53  * the address space flags too. The PCI version uses a BAR number
 54  * instead of an absolute index
 55  */
 56 extern const __be32 *of_get_address(struct device_node *dev, int index,
 57                            u64 *size, unsigned int *flags);
 58 
 59 extern unsigned long pci_address_to_pio(phys_addr_t addr);
 60 
 61 extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
 62                         struct device_node *node);
 63 extern struct of_pci_range *of_pci_range_parser_one(
 64                                         struct of_pci_range_parser *parser,
 65                                         struct of_pci_range *range);
 66 #else /* CONFIG_OF_ADDRESS */
 67 static inline struct device_node *of_find_matching_node_by_address(
 68                                         struct device_node *from,
 69                                         const struct of_device_id *matches,
 70                                         u64 base_address)
 71 {
 72         return NULL;
 73 }
 74 
 75 static inline const __be32 *of_get_address(struct device_node *dev, int index,
 76                                         u64 *size, unsigned int *flags)
 77 {
 78         return NULL;
 79 }
 80 
 81 static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,
 82                         struct device_node *node)
 83 {
 84         return -1;
 85 }
 86 
 87 static inline struct of_pci_range *of_pci_range_parser_one(
 88                                         struct of_pci_range_parser *parser,
 89                                         struct of_pci_range *range)
 90 {
 91         return NULL;
 92 }
 93 #endif /* CONFIG_OF_ADDRESS */
 94 
 95 #ifdef CONFIG_OF
 96 extern int of_address_to_resource(struct device_node *dev, int index,
 97                                   struct resource *r);
 98 void __iomem *of_iomap(struct device_node *node, int index);
 99 #else
100 static inline int of_address_to_resource(struct device_node *dev, int index,
101                                          struct resource *r)
102 {
103         return -EINVAL;
104 }
105 
106 static inline void __iomem *of_iomap(struct device_node *device, int index)
107 {
108         return NULL;
109 }
110 #endif
111 
112 #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
113 extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
114                                u64 *size, unsigned int *flags);
115 extern int of_pci_address_to_resource(struct device_node *dev, int bar,
116                                       struct resource *r);
117 #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
118 static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
119                                              struct resource *r)
120 {
121         return -ENOSYS;
122 }
123 
124 static inline const __be32 *of_get_pci_address(struct device_node *dev,
125                 int bar_no, u64 *size, unsigned int *flags)
126 {
127         return NULL;
128 }
129 #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
130 
131 #endif /* __OF_ADDRESS_H */
132 
133 

~ [ 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