aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2011-02-15 06:42:57 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-02-15 09:20:23 -0500
commitcae6292b653f5e3308bf2787a54b7dcd2cc7e2b3 (patch)
treeb9f6847d0cf392a9519800db3b99ea1e9090617e /arch
parentad6b9c9d78b9beebef02ac7f566a08db7be3c320 (diff)
ARM: 6672/1: LPAE: use phys_addr_t instead of unsigned long in mapping functions
The unsigned long datatype is not sufficient for mapping physical addresses >= 4GB. This patch ensures that the phys_addr_t datatype is used to represent physical addresses when converting from a PFN. Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/pgtable.h2
-rw-r--r--arch/arm/mm/init.c6
-rw-r--r--arch/arm/mm/mmu.c7
3 files changed, 8 insertions, 7 deletions
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index ebcb6432f45f..ca567914d303 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -351,7 +351,7 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd)
351#define pte_unmap(pte) __pte_unmap(pte) 351#define pte_unmap(pte) __pte_unmap(pte)
352 352
353#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) 353#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)
354#define pfn_pte(pfn,prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 354#define pfn_pte(pfn,prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot))
355 355
356#define pte_page(pte) pfn_to_page(pte_pfn(pte)) 356#define pte_page(pte) pfn_to_page(pte_pfn(pte))
357#define mk_pte(page,prot) pfn_pte(page_to_pfn(page), prot) 357#define mk_pte(page,prot) pfn_pte(page_to_pfn(page), prot)
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 5164069ced42..14a00a1ef52f 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -344,7 +344,7 @@ void __init bootmem_init(void)
344 */ 344 */
345 arm_bootmem_free(min, max_low, max_high); 345 arm_bootmem_free(min, max_low, max_high);
346 346
347 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1; 347 high_memory = __va(((phys_addr_t)max_low << PAGE_SHIFT) - 1) + 1;
348 348
349 /* 349 /*
350 * This doesn't seem to be used by the Linux memory manager any 350 * This doesn't seem to be used by the Linux memory manager any
@@ -392,8 +392,8 @@ free_memmap(unsigned long start_pfn, unsigned long end_pfn)
392 * Convert to physical addresses, and 392 * Convert to physical addresses, and
393 * round start upwards and end downwards. 393 * round start upwards and end downwards.
394 */ 394 */
395 pg = PAGE_ALIGN(__pa(start_pg)); 395 pg = (unsigned long)PAGE_ALIGN(__pa(start_pg));
396 pgend = __pa(end_pg) & PAGE_MASK; 396 pgend = (unsigned long)__pa(end_pg) & PAGE_MASK;
397 397
398 /* 398 /*
399 * If there are free pages between these, 399 * If there are free pages between these,
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index f512ad97dafe..e09744e82d50 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -591,7 +591,7 @@ static void __init create_36bit_mapping(struct map_desc *md,
591 pgd_t *pgd; 591 pgd_t *pgd;
592 592
593 addr = md->virtual; 593 addr = md->virtual;
594 phys = (unsigned long)__pfn_to_phys(md->pfn); 594 phys = __pfn_to_phys(md->pfn);
595 length = PAGE_ALIGN(md->length); 595 length = PAGE_ALIGN(md->length);
596 596
597 if (!(cpu_architecture() >= CPU_ARCH_ARMv6 || cpu_is_xsc3())) { 597 if (!(cpu_architecture() >= CPU_ARCH_ARMv6 || cpu_is_xsc3())) {
@@ -651,7 +651,8 @@ static void __init create_36bit_mapping(struct map_desc *md,
651 */ 651 */
652static void __init create_mapping(struct map_desc *md) 652static void __init create_mapping(struct map_desc *md)
653{ 653{
654 unsigned long phys, addr, length, end; 654 unsigned long addr, length, end;
655 phys_addr_t phys;
655 const struct mem_type *type; 656 const struct mem_type *type;
656 pgd_t *pgd; 657 pgd_t *pgd;
657 658
@@ -680,7 +681,7 @@ static void __init create_mapping(struct map_desc *md)
680 } 681 }
681 682
682 addr = md->virtual & PAGE_MASK; 683 addr = md->virtual & PAGE_MASK;
683 phys = (unsigned long)__pfn_to_phys(md->pfn); 684 phys = __pfn_to_phys(md->pfn);
684 length = PAGE_ALIGN(md->length + (md->virtual & ~PAGE_MASK)); 685 length = PAGE_ALIGN(md->length + (md->virtual & ~PAGE_MASK));
685 686
686 if (type->prot_l1 == 0 && ((addr | phys | length) & ~SECTION_MASK)) { 687 if (type->prot_l1 == 0 && ((addr | phys | length) & ~SECTION_MASK)) {