| .. | .. |
|---|
| 6 | 6 | #include <linux/of.h> |
|---|
| 7 | 7 | #include <linux/io.h> |
|---|
| 8 | 8 | |
|---|
| 9 | +struct of_bus; |
|---|
| 10 | + |
|---|
| 9 | 11 | struct of_pci_range_parser { |
|---|
| 10 | 12 | struct device_node *node; |
|---|
| 13 | + struct of_bus *bus; |
|---|
| 11 | 14 | const __be32 *range; |
|---|
| 12 | 15 | const __be32 *end; |
|---|
| 13 | | - int np; |
|---|
| 16 | + int na; |
|---|
| 17 | + int ns; |
|---|
| 14 | 18 | int pna; |
|---|
| 19 | + bool dma; |
|---|
| 15 | 20 | }; |
|---|
| 21 | +#define of_range_parser of_pci_range_parser |
|---|
| 16 | 22 | |
|---|
| 17 | 23 | struct of_pci_range { |
|---|
| 18 | | - u32 pci_space; |
|---|
| 19 | | - u64 pci_addr; |
|---|
| 24 | + union { |
|---|
| 25 | + u64 pci_addr; |
|---|
| 26 | + u64 bus_addr; |
|---|
| 27 | + }; |
|---|
| 20 | 28 | u64 cpu_addr; |
|---|
| 21 | 29 | u64 size; |
|---|
| 22 | 30 | u32 flags; |
|---|
| 23 | 31 | }; |
|---|
| 32 | +#define of_range of_pci_range |
|---|
| 24 | 33 | |
|---|
| 25 | 34 | #define for_each_of_pci_range(parser, range) \ |
|---|
| 26 | 35 | for (; of_pci_range_parser_one(parser, range);) |
|---|
| 36 | +#define for_each_of_range for_each_of_pci_range |
|---|
| 27 | 37 | |
|---|
| 28 | 38 | /* Translate a DMA address from device space to CPU space */ |
|---|
| 29 | 39 | extern u64 of_translate_dma_address(struct device_node *dev, |
|---|
| .. | .. |
|---|
| 33 | 43 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); |
|---|
| 34 | 44 | extern int of_address_to_resource(struct device_node *dev, int index, |
|---|
| 35 | 45 | struct resource *r); |
|---|
| 36 | | -extern struct device_node *of_find_matching_node_by_address( |
|---|
| 37 | | - struct device_node *from, |
|---|
| 38 | | - const struct of_device_id *matches, |
|---|
| 39 | | - u64 base_address); |
|---|
| 40 | 46 | extern void __iomem *of_iomap(struct device_node *device, int index); |
|---|
| 41 | 47 | void __iomem *of_io_request_and_map(struct device_node *device, |
|---|
| 42 | 48 | int index, const char *name); |
|---|
| .. | .. |
|---|
| 55 | 61 | extern struct of_pci_range *of_pci_range_parser_one( |
|---|
| 56 | 62 | struct of_pci_range_parser *parser, |
|---|
| 57 | 63 | struct of_pci_range *range); |
|---|
| 58 | | -extern int of_dma_get_range(struct device_node *np, u64 *dma_addr, |
|---|
| 59 | | - u64 *paddr, u64 *size); |
|---|
| 60 | 64 | extern bool of_dma_is_coherent(struct device_node *np); |
|---|
| 61 | 65 | #else /* CONFIG_OF_ADDRESS */ |
|---|
| 62 | 66 | static inline void __iomem *of_io_request_and_map(struct device_node *device, |
|---|
| .. | .. |
|---|
| 69 | 73 | const __be32 *addr) |
|---|
| 70 | 74 | { |
|---|
| 71 | 75 | return OF_BAD_ADDR; |
|---|
| 72 | | -} |
|---|
| 73 | | - |
|---|
| 74 | | -static inline struct device_node *of_find_matching_node_by_address( |
|---|
| 75 | | - struct device_node *from, |
|---|
| 76 | | - const struct of_device_id *matches, |
|---|
| 77 | | - u64 base_address) |
|---|
| 78 | | -{ |
|---|
| 79 | | - return NULL; |
|---|
| 80 | 76 | } |
|---|
| 81 | 77 | |
|---|
| 82 | 78 | static inline const __be32 *of_get_address(struct device_node *dev, int index, |
|---|
| .. | .. |
|---|
| 104 | 100 | return NULL; |
|---|
| 105 | 101 | } |
|---|
| 106 | 102 | |
|---|
| 107 | | -static inline int of_dma_get_range(struct device_node *np, u64 *dma_addr, |
|---|
| 108 | | - u64 *paddr, u64 *size) |
|---|
| 109 | | -{ |
|---|
| 110 | | - return -ENODEV; |
|---|
| 111 | | -} |
|---|
| 112 | | - |
|---|
| 113 | 103 | static inline bool of_dma_is_coherent(struct device_node *np) |
|---|
| 114 | 104 | { |
|---|
| 115 | 105 | return false; |
|---|
| .. | .. |
|---|
| 132 | 122 | return NULL; |
|---|
| 133 | 123 | } |
|---|
| 134 | 124 | #endif |
|---|
| 125 | +#define of_range_parser_init of_pci_range_parser_init |
|---|
| 135 | 126 | |
|---|
| 136 | 127 | #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) |
|---|
| 137 | 128 | extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, |
|---|
| .. | .. |
|---|
| 162 | 153 | #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
|---|
| 163 | 154 | |
|---|
| 164 | 155 | #endif /* __OF_ADDRESS_H */ |
|---|
| 165 | | - |
|---|