mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 05:29:04 -04:00
[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>
This commit is contained in:
parent
bb6b9b28d6
commit
d2dd482bc1
10 changed files with 251 additions and 36 deletions
|
|
@ -156,6 +156,15 @@ extern struct pci_controller *
|
|||
pcibios_alloc_controller(struct device_node *dev);
|
||||
extern void pcibios_free_controller(struct pci_controller *phb);
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
extern unsigned int pci_address_to_pio(phys_addr_t address);
|
||||
#else
|
||||
static inline unsigned int pci_address_to_pio(phys_addr_t address)
|
||||
{
|
||||
return (unsigned int)-1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return values for ppc_md.pci_probe_mode function */
|
||||
#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
|
||||
#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
|
||||
|
|
|
|||
|
|
@ -223,14 +223,36 @@ extern struct resource *request_OF_resource(struct device_node* node,
|
|||
int index, const char* name_postfix);
|
||||
extern int release_OF_resource(struct device_node* node, int index);
|
||||
|
||||
|
||||
/*
|
||||
* Address translation function(s)
|
||||
* OF address retreival & translation
|
||||
*/
|
||||
|
||||
|
||||
/* Translate an OF address block into a CPU physical address
|
||||
*/
|
||||
#define OF_BAD_ADDR ((u64)-1)
|
||||
extern u64 of_translate_address(struct device_node *np, u32 *addr);
|
||||
extern u32 *of_get_address(struct device_node *dev, int index, u64 *size);
|
||||
extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size);
|
||||
|
||||
/* Extract an address from a device, returns the region size and
|
||||
* the address space flags too. The PCI version uses a BAR number
|
||||
* instead of an absolute index
|
||||
*/
|
||||
extern u32 *of_get_address(struct device_node *dev, int index,
|
||||
u64 *size, unsigned int *flags);
|
||||
extern u32 *of_get_pci_address(struct device_node *dev, int bar_no,
|
||||
u64 *size, unsigned int *flags);
|
||||
|
||||
/* Get an address as a resource. Note that if your address is
|
||||
* a PIO address, the conversion will fail if the physical address
|
||||
* can't be internally converted to an IO token with
|
||||
* pci_address_to_pio(), that is because it's either called to early
|
||||
* or it can't be matched to any host bridge IO space
|
||||
*/
|
||||
extern int of_address_to_resource(struct device_node *dev, int index,
|
||||
struct resource *r);
|
||||
extern int of_pci_address_to_resource(struct device_node *dev, int bar,
|
||||
struct resource *r);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _POWERPC_PROM_H */
|
||||
|
|
|
|||
|
|
@ -137,5 +137,14 @@ static inline unsigned char bridge_swizzle(unsigned char pin,
|
|||
*/
|
||||
extern int pciauto_bus_scan(struct pci_controller *, int);
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
extern unsigned int pci_address_to_pio(phys_addr_t address);
|
||||
#else
|
||||
static inline unsigned int pci_address_to_pio(phys_addr_t address)
|
||||
{
|
||||
return (unsigned int)-1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* __KERNEL__ */
|
||||
|
|
|
|||
|
|
@ -138,12 +138,34 @@ extern unsigned long sub_reloc_offset(unsigned long);
|
|||
|
||||
|
||||
/*
|
||||
* Address translation function(s)
|
||||
* OF address retreival & translation
|
||||
*/
|
||||
|
||||
|
||||
/* Translate an OF address block into a CPU physical address
|
||||
*/
|
||||
#define OF_BAD_ADDR ((u64)-1)
|
||||
extern u64 of_translate_address(struct device_node *np, u32 *addr);
|
||||
extern u32 *of_get_address(struct device_node *dev, int index, u64 *size);
|
||||
extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size);
|
||||
|
||||
/* Extract an address from a device, returns the region size and
|
||||
* the address space flags too. The PCI version uses a BAR number
|
||||
* instead of an absolute index
|
||||
*/
|
||||
extern u32 *of_get_address(struct device_node *dev, int index,
|
||||
u64 *size, unsigned int *flags);
|
||||
extern u32 *of_get_pci_address(struct device_node *dev, int bar_no,
|
||||
u64 *size, unsigned int *flags);
|
||||
|
||||
/* Get an address as a resource. Note that if your address is
|
||||
* a PIO address, the conversion will fail if the physical address
|
||||
* can't be internally converted to an IO token with
|
||||
* pci_address_to_pio(), that is because it's either called to early
|
||||
* or it can't be matched to any host bridge IO space
|
||||
*/
|
||||
extern int of_address_to_resource(struct device_node *dev, int index,
|
||||
struct resource *r);
|
||||
extern int of_pci_address_to_resource(struct device_node *dev, int bar,
|
||||
struct resource *r);
|
||||
|
||||
|
||||
#endif /* _PPC_PROM_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue