summaryrefslogtreecommitdiffstats
path: root/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'layout.c')
-rw-r--r--layout.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/layout.c b/layout.c
index e10bb735a..5080e3ed7 100644
--- a/layout.c
+++ b/layout.c
@@ -227,3 +227,21 @@ int normalize_romentries(const struct flashctx *flash)
return ret;
}
+
+const struct romentry *layout_next_included_region(
+ const struct flashrom_layout *const l, const chipoff_t where)
+{
+ unsigned int i;
+ const struct romentry *lowest = NULL;
+
+ for (i = 0; i < l->num_entries; ++i) {
+ if (!l->entries[i].included)
+ continue;
+ if (l->entries[i].end < where)
+ continue;
+ if (!lowest || lowest->start > l->entries[i].start)
+ lowest = &l->entries[i];
+ }
+
+ return lowest;
+}