The only PCI specific part of of_pci_range_parser_one() is the handling of the 3rd address cell. Rework it to work on regular 1 and 2 cell addresses. Use defines and a union to avoid a treewide renaming of the parsing helpers and struct.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -10,20 +10,27 @@ struct of_pci_range_parser { · 9 unmodified lines | ||
| 10 | 10 | struct device_node *node; |
| 11 | 11 | const __be32 *range; |
| 12 | 12 | const __be32 *end; |
| 13 | − int np; | |
| 13 | + int na; | |
| 14 | + int ns; | |
| 14 | 15 | int pna; |
| 15 | 16 | bool dma; |
| 16 | 17 | }; |
| 18 | +#define of_range_parser of_pci_range_parser | |
| 17 | 19 | |
| 18 | 20 | struct of_pci_range { |
| 19 | − u64 pci_addr; | |
| 21 | + union { | |
| 22 | + u64 pci_addr; | |
| 23 | + u64 bus_addr; | |
| 24 | + }; | |
| 20 | 25 | u64 cpu_addr; |
| 21 | 26 | u64 size; |
| 22 | 27 | u32 flags; |
| 23 | 28 | }; |
| 29 | +#define of_range of_pci_range | |
| 24 | 30 | |
| 25 | 31 | #define for_each_of_pci_range(parser, range) \ |
| 26 | 32 | for (; of_pci_range_parser_one(parser, range);) |
| 33 | +#define for_each_of_range for_each_of_pci_range | |
| 27 | 34 | |
| 28 | 35 | /* Translate a DMA address from device space to CPU space */ |
| 29 | 36 | extern u64 of_translate_dma_address(struct device_node *dev, |
| @@ -142,4 +149,3 @@ static inline int of_pci_range_to_resource(struct of_pci_range *range, · 112 unmodified lines | ||
| 142 | 149 | #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
| 143 | 150 | |
| 144 | 151 | #endif /* __OF_ADDRESS_H */ |
| 145 | − | |