forked from pool/u-boot
OBS-URL: https://build.opensuse.org/request/show/1066717 OBS-URL: https://build.opensuse.org/package/show/hardware:boot/u-boot?expand=0&rev=184
35 lines
1.3 KiB
Diff
35 lines
1.3 KiB
Diff
From 8a5a3aa5d3ee1a06f654fad4f648aa9c550f889e Mon Sep 17 00:00:00 2001
|
|
From: Sjoerd Simons <sjoerd@collabora.com>
|
|
Date: Sun, 12 Feb 2023 16:07:05 +0100
|
|
Subject: [PATCH] lmb: Treat a region which is a subset as equal
|
|
|
|
In various cases logical memory blocks are coalesced; As a result doing
|
|
a strict check whether memory blocks are the same doesn't necessarily
|
|
work as a previous addition of a given block might have been merged into
|
|
a bigger block.
|
|
|
|
Fix this by considering a block is already registered if it's a pure
|
|
subset of one of the existing blocks.
|
|
|
|
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
|
|
---
|
|
lib/lmb.c | 4 +++-
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/lmb.c b/lib/lmb.c
|
|
index ec790760db..866b0699d5 100644
|
|
--- a/lib/lmb.c
|
|
+++ b/lib/lmb.c
|
|
@@ -244,8 +244,10 @@ static long lmb_add_region_flags(struct lmb_region *rgn, phys_addr_t base,
|
|
phys_addr_t rgnbase = rgn->region[i].base;
|
|
phys_size_t rgnsize = rgn->region[i].size;
|
|
phys_size_t rgnflags = rgn->region[i].flags;
|
|
+ phys_addr_t end = base + size - 1;
|
|
+ phys_addr_t rgnend = rgnbase + rgnsize - 1;
|
|
|
|
- if (rgnbase == base && rgnsize == size) {
|
|
+ if (rgnbase <= base && end <= rgnend) {
|
|
if (flags == rgnflags)
|
|
/* Already have this region, so we're done */
|
|
return 0;
|