From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pf0-x230.google.com ([2607:f8b0:400e:c00::230]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fKxmJ-0002HX-5P for barebox@lists.infradead.org; Tue, 22 May 2018 03:16:15 +0000 Received: by mail-pf0-x230.google.com with SMTP id a20-v6so8044135pfo.0 for ; Mon, 21 May 2018 20:15:48 -0700 (PDT) From: Andrey Smirnov Date: Mon, 21 May 2018 20:14:56 -0700 Message-Id: <20180522031510.25505-16-andrew.smirnov@gmail.com> In-Reply-To: <20180522031510.25505-1-andrew.smirnov@gmail.com> References: <20180522031510.25505-1-andrew.smirnov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v4 15/29] ARM: mmu: Replace various SZ_1M with PGDIR_SIZE To: barebox@lists.infradead.org Cc: Andrey Smirnov Signed-off-by: Andrey Smirnov --- 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 83577300f..de242e0d7 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 4f6ab2e71..211770af8 100644 --- a/arch/arm/cpu/mmu.h +++ b/arch/arm/cpu/mmu.h @@ -5,6 +5,7 @@ #include #define PGDIR_SHIFT 20 +#define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define pgd_index(addr) ((addr) >> PGDIR_SHIFT) @@ -41,7 +42,7 @@ create_sections(uint32_t *ttb, unsigned long first, for (i = ttb_start; i < ttb_end; i++) { ttb[i] = addr | flags; - addr += SZ_1M; + addr += PGDIR_SIZE; } } -- 2.17.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox