[coreboot-gerrit] New patch to review for coreboot: cdf9c9b memranges: add memranges_update_tag() functionality
Aaron Durbin (adurbin@google.com)
gerrit at coreboot.org
Wed Feb 5 22:46:46 CET 2014
Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5150
-gerrit
commit cdf9c9b4c84f27207b10f6778e6df688b8deb9fe
Author: Aaron Durbin <adurbin at chromium.org>
Date: Wed Feb 5 15:44:30 2014 -0600
memranges: add memranges_update_tag() functionality
The memranges_update_tag() function replaces all instances
that are tagged with old_tag and update to new_tag. This
can be helpful in the MTRR code by adjusting the address
space if certain memory types cause the MTRR usage to
become too large.
Change-Id: Ie5c405204de2fdd9fd1dd5d6190b223925d6d318
Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
src/include/memrange.h | 4 ++++
src/lib/memrange.c | 13 +++++++++++++
2 files changed, 17 insertions(+)
diff --git a/src/include/memrange.h b/src/include/memrange.h
index 0e69b2f..4f094f5 100644
--- a/src/include/memrange.h
+++ b/src/include/memrange.h
@@ -110,6 +110,10 @@ void memranges_create_hole(struct memranges *ranges,
void memranges_insert(struct memranges *ranges,
resource_t base, resource_t size, unsigned long tag);
+/* Update all entries with old_tag to new_tag. */
+void memranges_update_tag(struct memranges *ranges, unsigned long old_tag,
+ unsigned long new_tag);
+
/* Returns next entry after the provided entry. NULL if r is last. */
struct range_entry *memranges_next_entry(struct memranges *ranges,
const struct range_entry *r);
diff --git a/src/lib/memrange.c b/src/lib/memrange.c
index af56e72..0ebac05 100644
--- a/src/lib/memrange.c
+++ b/src/lib/memrange.c
@@ -204,6 +204,19 @@ static void merge_add_memranges(struct memranges *ranges,
merge_neighbor_entries(ranges);
}
+void memranges_update_tag(struct memranges *ranges, unsigned long old_tag,
+ unsigned long new_tag)
+{
+ struct range_entry *r;
+
+ memranges_each_entry(r, ranges) {
+ if (range_entry_tag(r) == old_tag)
+ range_entry_update_tag(r, new_tag);
+ }
+
+ merge_neighbor_entries(ranges);
+}
+
typedef void (*range_action_t)(struct memranges *ranges,
resource_t begin, resource_t end,
unsigned long tag);
More information about the coreboot-gerrit
mailing list