From: Matt Porter Fixes io_remap_page_range() to use the 32-bit address translator similar to ioremap(). Someday u64 start/end resources should make this unnecessary. Fixes set_pte() to handle a long long pte_t properly. Signed-off-by: Matt Porter Signed-off-by: Andrew Morton --- 25-akpm/arch/ppc/Kconfig | 5 +++++ 25-akpm/arch/ppc/syslib/ibm44x_common.c | 2 ++ 25-akpm/include/asm-ppc/pgtable.h | 16 +++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff -puN arch/ppc/Kconfig~ppc32-fix-io_remap_page_range-for-36-bit-phys-platforms arch/ppc/Kconfig --- 25/arch/ppc/Kconfig~ppc32-fix-io_remap_page_range-for-36-bit-phys-platforms Thu Dec 16 17:05:00 2004 +++ 25-akpm/arch/ppc/Kconfig Thu Dec 16 17:05:00 2004 @@ -97,6 +97,11 @@ config PTE_64BIT depends on 44x default y +config PHYS_64BIT + bool + depends on 44x + default y + config ALTIVEC bool "AltiVec Support" depends on 6xx || POWER4 diff -puN arch/ppc/syslib/ibm44x_common.c~ppc32-fix-io_remap_page_range-for-36-bit-phys-platforms arch/ppc/syslib/ibm44x_common.c --- 25/arch/ppc/syslib/ibm44x_common.c~ppc32-fix-io_remap_page_range-for-36-bit-phys-platforms Thu Dec 16 17:05:00 2004 +++ 25-akpm/arch/ppc/syslib/ibm44x_common.c Thu Dec 16 17:05:00 2004 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -47,6 +48,7 @@ phys_addr_t fixup_bigphys_addr(phys_addr return (page_4gb | addr); }; +EXPORT_SYMBOL(fixup_bigphys_addr); void __init ibm44x_calibrate_decr(unsigned int freq) { diff -puN include/asm-ppc/pgtable.h~ppc32-fix-io_remap_page_range-for-36-bit-phys-platforms include/asm-ppc/pgtable.h --- 25/include/asm-ppc/pgtable.h~ppc32-fix-io_remap_page_range-for-36-bit-phys-platforms Thu Dec 16 17:05:00 2004 +++ 25-akpm/include/asm-ppc/pgtable.h Thu Dec 16 17:05:00 2004 @@ -431,7 +431,7 @@ extern unsigned long bad_call_to_PMD_PAG #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) #define pte_page(x) pfn_to_page(pte_pfn(x)) -#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) +#define pfn_pte(pfn, prot) __pte(((pte_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)) #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) /* @@ -711,8 +711,22 @@ extern void kernel_set_cachemode (unsign /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ #define kern_addr_valid(addr) (1) +#ifdef CONFIG_PHYS_64BIT +extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, + unsigned long paddr, unsigned long size, pgprot_t prot); +static inline int io_remap_page_range(struct vm_area_struct *vma, + unsigned long vaddr, + unsigned long paddr, + unsigned long size, + pgprot_t prot) +{ + phys_addr_t paddr64 = fixup_bigphys_addr(paddr, size); + return remap_pfn_range(vma, vaddr, paddr64 >> PAGE_SHIFT, size, prot); +} +#else #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) +#endif /* * No page table caches to initialise _