diff options
| author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-11-30 00:57:28 -0500 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2006-01-08 22:51:26 -0500 |
| commit | d2dd482bc17c3bc240045f80a7c4b4d5cea5e29c (patch) | |
| tree | 9c40a9ab9a04839f2d578f9d47985b399074ce58 /include | |
| parent | bb6b9b28d6847bc71f910e2e82c9040ff4b97ec0 (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')
| -rw-r--r-- | include/asm-powerpc/pci-bridge.h | 9 | ||||
| -rw-r--r-- | include/asm-powerpc/prom.h | 28 | ||||
| -rw-r--r-- | include/asm-ppc/pci-bridge.h | 9 | ||||
| -rw-r--r-- | include/asm-ppc/prom.h | 28 |
4 files changed, 68 insertions, 6 deletions
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h index 00d21513d009..01132bb602e3 100644 --- a/include/asm-powerpc/pci-bridge.h +++ b/include/asm-powerpc/pci-bridge.h | |||
| @@ -156,6 +156,15 @@ extern struct pci_controller * | |||
| 156 | pcibios_alloc_controller(struct device_node *dev); | 156 | pcibios_alloc_controller(struct device_node *dev); |
| 157 | extern void pcibios_free_controller(struct pci_controller *phb); | 157 | extern void pcibios_free_controller(struct pci_controller *phb); |
| 158 | 158 | ||
| 159 | #ifdef CONFIG_PCI | ||
| 160 | extern unsigned int pci_address_to_pio(phys_addr_t address); | ||
| 161 | #else | ||
| 162 | static inline unsigned int pci_address_to_pio(phys_addr_t address) | ||
| 163 | { | ||
| 164 | return (unsigned int)-1; | ||
| 165 | } | ||
| 166 | #endif | ||
| 167 | |||
| 159 | /* Return values for ppc_md.pci_probe_mode function */ | 168 | /* Return values for ppc_md.pci_probe_mode function */ |
| 160 | #define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ | 169 | #define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ |
| 161 | #define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ | 170 | #define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ |
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h index fb732c992bd2..73d27bad55fa 100644 --- a/include/asm-powerpc/prom.h +++ b/include/asm-powerpc/prom.h | |||
| @@ -223,14 +223,36 @@ extern struct resource *request_OF_resource(struct device_node* node, | |||
| 223 | int index, const char* name_postfix); | 223 | int index, const char* name_postfix); |
| 224 | extern int release_OF_resource(struct device_node* node, int index); | 224 | extern int release_OF_resource(struct device_node* node, int index); |
| 225 | 225 | ||
| 226 | |||
| 226 | /* | 227 | /* |
| 227 | * Address translation function(s) | 228 | * OF address retreival & translation |
| 229 | */ | ||
| 230 | |||
| 231 | |||
| 232 | /* Translate an OF address block into a CPU physical address | ||
| 228 | */ | 233 | */ |
| 229 | #define OF_BAD_ADDR ((u64)-1) | 234 | #define OF_BAD_ADDR ((u64)-1) |
| 230 | extern u64 of_translate_address(struct device_node *np, u32 *addr); | 235 | extern u64 of_translate_address(struct device_node *np, u32 *addr); |
| 231 | extern u32 *of_get_address(struct device_node *dev, int index, u64 *size); | ||
| 232 | extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size); | ||
| 233 | 236 | ||
| 237 | /* Extract an address from a device, returns the region size and | ||
| 238 | * the address space flags too. The PCI version uses a BAR number | ||
| 239 | * instead of an absolute index | ||
| 240 | */ | ||
| 241 | extern u32 *of_get_address(struct device_node *dev, int index, | ||
| 242 | u64 *size, unsigned int *flags); | ||
| 243 | extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, | ||
| 244 | u64 *size, unsigned int *flags); | ||
| 245 | |||
| 246 | /* Get an address as a resource. Note that if your address is | ||
| 247 | * a PIO address, the conversion will fail if the physical address | ||
| 248 | * can't be internally converted to an IO token with | ||
| 249 | * pci_address_to_pio(), that is because it's either called to early | ||
| 250 | * or it can't be matched to any host bridge IO space | ||
| 251 | */ | ||
| 252 | extern int of_address_to_resource(struct device_node *dev, int index, | ||
| 253 | struct resource *r); | ||
| 254 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, | ||
| 255 | struct resource *r); | ||
| 234 | 256 | ||
| 235 | #endif /* __KERNEL__ */ | 257 | #endif /* __KERNEL__ */ |
| 236 | #endif /* _POWERPC_PROM_H */ | 258 | #endif /* _POWERPC_PROM_H */ |
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 | */ |
| 138 | extern int pciauto_bus_scan(struct pci_controller *, int); | 138 | extern int pciauto_bus_scan(struct pci_controller *, int); |
| 139 | 139 | ||
| 140 | #ifdef CONFIG_PCI | ||
| 141 | extern unsigned int pci_address_to_pio(phys_addr_t address); | ||
| 142 | #else | ||
| 143 | static 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) |
| 144 | extern u64 of_translate_address(struct device_node *np, u32 *addr); | 148 | extern u64 of_translate_address(struct device_node *np, u32 *addr); |
| 145 | extern u32 *of_get_address(struct device_node *dev, int index, u64 *size); | 149 | |
| 146 | extern 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 | */ | ||
| 154 | extern u32 *of_get_address(struct device_node *dev, int index, | ||
| 155 | u64 *size, unsigned int *flags); | ||
| 156 | extern 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 | */ | ||
| 165 | extern int of_address_to_resource(struct device_node *dev, int index, | ||
| 166 | struct resource *r); | ||
| 167 | extern 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 */ |
