diff options
author | Varadarajan Narayanan <varada@codeaurora.org> | 2016-03-03 15:14:46 +0530 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2016-05-09 06:44:32 +0200 |
commit | 0067a426e7549845ba80e37c62395c1cf1234540 (patch) | |
tree | 47ad357987fa9acaa9c99830a973aefe2dd06dce /src/arch/arm | |
parent | e8e219d63daae394c5fbccbe963f536d78a02fb6 (diff) |
arch/armv7: Fix end index calculation in mmu_config_range_kb
BUG=chrome-os-partner:49249
TEST=None. Initial code not sure if it will even compile
BRANCH=none
Change-Id: Ib0fccfe2d103710c006cb3950c65b11b8d596912
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 9be5f58bb89ec43d4eb264c94c3f745dcade35dd
Original-Change-Id: If50efb55d4974dfcab07d3ae6488c2413b505a1f
Original-Signed-off-by: Varadarajan Narayanan <varada@codeaurora.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/333301
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/14657
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/arch/arm')
-rw-r--r-- | src/arch/arm/armv7/mmu.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/arch/arm/armv7/mmu.c b/src/arch/arm/armv7/mmu.c index 2cf90e75f7..b1c1aac0c0 100644 --- a/src/arch/arm/armv7/mmu.c +++ b/src/arch/arm/armv7/mmu.c @@ -218,8 +218,14 @@ void mmu_config_range_kb(u32 start_kb, u32 size_kb, enum dcache_policy policy) u32 mask = BLOCK_SIZE/KiB - 1; printk(BIOS_DEBUG, "Mapping address range [%#.8x:%#.8x) as %s\n", start_kb * KiB, (start_kb + size_kb) * KiB, attrs[policy].name); + + u32 end_kb = ALIGN_UP((start_kb + size_kb), PAGE_SIZE/KiB) - + (start_kb & ~mask); + + assert(end_kb <= BLOCK_SIZE/KiB); + mmu_fill_table(table, (start_kb & mask) / (PAGE_SIZE/KiB), - div_round_up((start_kb + size_kb) & mask, PAGE_SIZE/KiB), + end_kb / (PAGE_SIZE/KiB), (start_kb & ~mask) * KiB, PAGE_SHIFT, ATTR_PAGE | attr); } |