Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- arch/arm/cpu/mmu.c | 8 ++++---- arch/arm/cpu/mmu.h | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index d8fb3afa4..228fef433 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -196,7 +196,7 @@ void *map_io_sections(unsigned long phys, void *_start, size_t size) { unsigned long start = (unsigned long)_start, sec; - for (sec = start; sec < start + size; sec += (1 << 20), phys += SZ_1M) + for (sec = start; sec < start + size; sec += PGDIR_SIZE, phys += PGDIR_SIZE) ttb[pgd_index(sec)] = phys | PMD_SECT_DEF_UNCACHED; dma_flush_range((unsigned long)ttb, (unsigned long)ttb + 0x4000); @@ -224,7 +224,7 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank) * We replace each 1MiB section in this range with second level page * tables, therefore we must have 1Mib aligment here. */ - if (!IS_ALIGNED(phys, SZ_1M) || !IS_ALIGNED(bank->size, SZ_1M)) + if (!IS_ALIGNED(phys, PGDIR_SIZE) || !IS_ALIGNED(bank->size, PGDIR_SIZE)) return -EINVAL; ptes = xmemalign(PAGE_SIZE, num_ptes * sizeof(u32)); @@ -289,8 +289,8 @@ static void create_vector_table(unsigned long adr) vectors = xmemalign(PAGE_SIZE, PAGE_SIZE); pr_debug("Creating vector table, virt = 0x%p, phys = 0x%08lx\n", vectors, adr); - exc = arm_create_pte(ALIGN_DOWN(adr, SZ_1M)); - idx = (adr & (SZ_1M - 1)) >> PAGE_SHIFT; + exc = arm_create_pte(ALIGN_DOWN(adr, PGDIR_SIZE)); + idx = (adr & (PGDIR_SIZE - 1)) >> PAGE_SHIFT; exc[idx] = (u32)vectors | PTE_TYPE_SMALL | pte_flags_cached; } diff --git a/arch/arm/cpu/mmu.h b/arch/arm/cpu/mmu.h index 13a10c7b7..67cc670f0 100644 --- a/arch/arm/cpu/mmu.h +++ b/arch/arm/cpu/mmu.h @@ -5,6 +5,7 @@ #include <linux/sizes.h> #define PGDIR_SHIFT 20 +#define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define pgd_index(addr) ((addr) >> PGDIR_SHIFT) @@ -39,7 +40,7 @@ __create_sections(uint32_t *ttb, unsigned long first, unsigned long ttb_end = pgd_index(last) + 1; unsigned int i, addr; - for (i = ttb_start, addr = first; i < ttb_end; i++, addr += SZ_1M) + for (i = ttb_start, addr = first; i < ttb_end; i++, addr += PGDIR_SIZE) ttb[i] = addr | flags; } -- 2.17.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox