summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2022-07-01 15:45:56 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-07-08 00:00:24 +0000
commit1793eb4c8a6b31ba4723c268870ebe7e071957f9 (patch)
treec71074f79a46ea2f0e678b58ebfaf8093a17955d /src/lib
parent25c20753885fb183424b5d74445a3a8643fe2d28 (diff)
downloadcoreboot-1793eb4c8a6b31ba4723c268870ebe7e071957f9.tar.gz
coreboot-1793eb4c8a6b31ba4723c268870ebe7e071957f9.tar.bz2
coreboot-1793eb4c8a6b31ba4723c268870ebe7e071957f9.zip
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>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/fit.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/src/lib/fit.c b/src/lib/fit.c
index 6b4067e6f1bd..051395054a51 100644
--- a/src/lib/fit.c
+++ b/src/lib/fit.c
@@ -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;
}