History

of/address: Rework of_pci_range parsing for non-PCI buses

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.

Rob Herring committed 6 years ago

Commit bc5e5221 parent c67f3df2 files · +30 −15Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/of_address.h+9−3
@@ -10,20 +10,27 @@ struct of_pci_range_parser { · 9 unmodified lines
10 struct device_node *node;10 struct device_node *node;
11 const __be32 *range;11 const __be32 *range;
12 const __be32 *end;12 const __be32 *end;
13 int np;13 int na;
14 int ns;
14 int pna;15 int pna;
15 bool dma;16 bool dma;
16};17};
18#define of_range_parser of_pci_range_parser
17 19
18struct of_pci_range {20struct of_pci_range {
19 u64 pci_addr;21 union {
22 u64 pci_addr;
23 u64 bus_addr;
24 };
20 u64 cpu_addr;25 u64 cpu_addr;
21 u64 size;26 u64 size;
22 u32 flags;27 u32 flags;
23};28};
29#define of_range of_pci_range
24 30
25#define for_each_of_pci_range(parser, range) \31#define for_each_of_pci_range(parser, range) \
26 for (; of_pci_range_parser_one(parser, range);)32 for (; of_pci_range_parser_one(parser, range);)
33#define for_each_of_range for_each_of_pci_range
27 34
28/* Translate a DMA address from device space to CPU space */35/* Translate a DMA address from device space to CPU space */
29extern u64 of_translate_dma_address(struct device_node *dev,36extern 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#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */149#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
143 150
144#endif /* __OF_ADDRESS_H */151#endif /* __OF_ADDRESS_H */
145