aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-11-30 00:57:28 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-08 22:51:26 -0500
commitd2dd482bc17c3bc240045f80a7c4b4d5cea5e29c (patch)
tree9c40a9ab9a04839f2d578f9d47985b399074ce58 /include/asm-ppc
parentbb6b9b28d6847bc71f910e2e82c9040ff4b97ec0 (diff)
[PATCH] powerpc: Update OF address parsers
This updates the OF address parsers to return the IO flags indicating the type of address obtained. It also adds a PCI call for converting physical addresses that hit IO space into into IO tokens, and add routines that return the translated addresses into struct resource Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-ppc')
-rw-r--r--include/asm-ppc/pci-bridge.h9
-rw-r--r--include/asm-ppc/prom.h28
2 files changed, 34 insertions, 3 deletions
diff --git a/include/asm-ppc/pci-bridge.h b/include/asm-ppc/pci-bridge.h
index e58c78f90a5a..95672ddfe528 100644
--- a/include/asm-ppc/pci-bridge.h
+++ b/include/asm-ppc/pci-bridge.h
@@ -137,5 +137,14 @@ static inline unsigned char bridge_swizzle(unsigned char pin,
137 */ 137 */
138extern int pciauto_bus_scan(struct pci_controller *, int); 138extern int pciauto_bus_scan(struct pci_controller *, int);
139 139
140#ifdef CONFIG_PCI
141extern unsigned int pci_address_to_pio(phys_addr_t address);
142#else
143static inline unsigned int pci_address_to_pio(phys_addr_t address)
144{
145 return (unsigned int)-1;
146}
147#endif
148
140#endif 149#endif
141#endif /* __KERNEL__ */ 150#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h
index a10a2d64b300..eb317a0806e4 100644
--- a/include/asm-ppc/prom.h
+++ b/include/asm-ppc/prom.h
@@ -138,12 +138,34 @@ extern unsigned long sub_reloc_offset(unsigned long);
138 138
139 139
140/* 140/*
141 * Address translation function(s) 141 * OF address retreival & translation
142 */
143
144
145/* Translate an OF address block into a CPU physical address
142 */ 146 */
143#define OF_BAD_ADDR ((u64)-1) 147#define OF_BAD_ADDR ((u64)-1)
144extern u64 of_translate_address(struct device_node *np, u32 *addr); 148extern u64 of_translate_address(struct device_node *np, u32 *addr);
145extern u32 *of_get_address(struct device_node *dev, int index, u64 *size); 149
146extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size); 150/* Extract an address from a device, returns the region size and
151 * the address space flags too. The PCI version uses a BAR number
152 * instead of an absolute index
153 */
154extern u32 *of_get_address(struct device_node *dev, int index,
155 u64 *size, unsigned int *flags);
156extern u32 *of_get_pci_address(struct device_node *dev, int bar_no,
157 u64 *size, unsigned int *flags);
158
159/* Get an address as a resource. Note that if your address is
160 * a PIO address, the conversion will fail if the physical address
161 * can't be internally converted to an IO token with
162 * pci_address_to_pio(), that is because it's either called to early
163 * or it can't be matched to any host bridge IO space
164 */
165extern int of_address_to_resource(struct device_node *dev, int index,
166 struct resource *r);
167extern int of_pci_address_to_resource(struct device_node *dev, int bar,
168 struct resource *r);
147 169
148 170
149#endif /* _PPC_PROM_H */ 171#endif /* _PPC_PROM_H */