summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/mmu.c
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-05-21 20:15:05 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2018-05-22 09:13:55 +0200
commit79a34e861d4124ba47e2a0b66ca72ff69b799663 (patch)
tree7ccc86591d4bb4a6d83539167c620845a3dac86d /arch/arm/cpu/mmu.c
parent6419c463d28ff4a48a1a9244c57644497f59ddb6 (diff)
downloadbarebox-79a34e861d4124ba47e2a0b66ca72ff69b799663.tar.gz
barebox-79a34e861d4124ba47e2a0b66ca72ff69b799663.tar.xz
ARM: mmu: Use find_pte() to find PTE in create_vector_table()
There's already a function that implement necessary arithemtic to find offset within page table for a given address, so make use of it instead of re-implementing it again. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu/mmu.c')
-rw-r--r--arch/arm/cpu/mmu.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
index 21394deb13..f9e4d1a506 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -272,8 +272,7 @@ static void create_vector_table(unsigned long adr)
{
struct resource *vectors_sdram;
void *vectors;
- u32 *exc;
- int idx;
+ u32 *pte;
vectors_sdram = request_sdram_region("vector table", adr, PAGE_SIZE);
if (vectors_sdram) {
@@ -293,9 +292,9 @@ 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(adr, pte_flags_uncached);
- idx = (adr & (PGDIR_SIZE - 1)) >> PAGE_SHIFT;
- exc[idx] = (u32)vectors | PTE_TYPE_SMALL | pte_flags_cached;
+ arm_create_pte(adr, pte_flags_uncached);
+ pte = find_pte(adr);
+ *pte = (u32)vectors | PTE_TYPE_SMALL | pte_flags_cached;
}
arm_fixup_vectors();