summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-02-05 15:44:30 -0600
committerAaron Durbin <adurbin@google.com>2014-02-06 00:08:59 +0100
commited9307db13671ee347a3f1288e87da508139feea (patch)
tree3239fb71e90f5b6757a8dd120138f5f411d77232 /src/lib
parent3d6ffe76f8a505c2dff5d5c6146da3d63dad6e82 (diff)
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@chromium.org> Reviewed-on: http://review.coreboot.org/5150 Tested-by: build bot (Jenkins) Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/memrange.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/memrange.c b/src/lib/memrange.c
index af56e72159..0ebac0534e 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);