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)
This commit is contained in:
parent
e8e219d63d
commit
0067a426e7
|
@ -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;
|
u32 mask = BLOCK_SIZE/KiB - 1;
|
||||||
printk(BIOS_DEBUG, "Mapping address range [%#.8x:%#.8x) as %s\n",
|
printk(BIOS_DEBUG, "Mapping address range [%#.8x:%#.8x) as %s\n",
|
||||||
start_kb * KiB, (start_kb + size_kb) * KiB, attrs[policy].name);
|
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),
|
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);
|
(start_kb & ~mask) * KiB, PAGE_SHIFT, ATTR_PAGE | attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue