lib/fit.c: Don't align memory regions to 1MB
Aligning the "memory" ranges in devicetree is supposedly only needed on very old arm32 kernels. So let's get rid of it. Incidentally this fixes smaller than 1MB memory regions where the size would end up being 0. Change-Id: Ibbf5e331c79ed4ae3ed8dd37bf7a974d2412ce12 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/65607 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
25c2075388
commit
1793eb4c8a
|
@ -287,35 +287,12 @@ struct mem_map {
|
|||
static bool walk_memory_table(const struct range_entry *r, void *arg)
|
||||
{
|
||||
struct mem_map *arg_map = arg;
|
||||
struct memranges *ranges;
|
||||
enum bootmem_type tag;
|
||||
|
||||
/*
|
||||
* Kernel likes its available memory areas at least 1MB
|
||||
* aligned, let's trim the regions such that unaligned padding
|
||||
* is added to reserved memory.
|
||||
*/
|
||||
if (range_entry_tag(r) == BM_MEM_RAM) {
|
||||
uint64_t new_start = ALIGN_UP(range_entry_base(r), 1 * MiB);
|
||||
uint64_t new_end = ALIGN_DOWN(range_entry_end(r), 1 * MiB);
|
||||
|
||||
if (new_start != range_entry_base(r))
|
||||
memranges_insert(&arg_map->reserved,
|
||||
range_entry_base(r),
|
||||
new_start - range_entry_base(r),
|
||||
BM_MEM_RESERVED);
|
||||
|
||||
if (new_start != new_end)
|
||||
memranges_insert(&arg_map->mem, new_start,
|
||||
new_end - new_start, BM_MEM_RAM);
|
||||
|
||||
if (new_end != range_entry_end(r))
|
||||
memranges_insert(&arg_map->reserved, new_end,
|
||||
range_entry_end(r) - new_end,
|
||||
BM_MEM_RESERVED);
|
||||
} else
|
||||
memranges_insert(&arg_map->reserved, range_entry_base(r),
|
||||
range_entry_size(r),
|
||||
BM_MEM_RESERVED);
|
||||
|
||||
ranges = range_entry_tag(r) == BM_MEM_RAM ? &arg_map->mem : &arg_map->reserved;
|
||||
tag = range_entry_tag(r) == BM_MEM_RAM ? BM_MEM_RAM : BM_MEM_RESERVED;
|
||||
memranges_insert(ranges, range_entry_base(r), range_entry_size(r), tag);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue