Furquan Shaikh (furquan@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17238
-gerrit
commit ad7ad5bdf672f4a3802fa6262c65af2808de81fc Author: Furquan Shaikh furquan@chromium.org Date: Sat Nov 5 23:37:11 2016 -0700
fmap: Add support for checking existence of region
Implement fmap_region_exists which acts as a wrapper for checking if a region name exists in FMAP.
BUG=chrome-os-partner:59352 BRANCH=None TEST=Verified that fmap_exists returns existence of region names present in FMAP.
Change-Id: I288ea8c7c57d3b0f237cdece42c4f5fe9c2c066a Signed-off-by: Furquan Shaikh furquan@chromium.org --- src/include/fmap.h | 3 +++ src/lib/fmap.c | 6 ++++++ 2 files changed, 9 insertions(+)
diff --git a/src/include/fmap.h b/src/include/fmap.h index 5834831..774fbfe 100644 --- a/src/include/fmap.h +++ b/src/include/fmap.h @@ -36,6 +36,9 @@ int fmap_locate_area_as_rdev_rw(const char *name, struct region_device *area); * < 0 on error. */ int fmap_locate_area(const char *name, struct region *r);
+/* Check if region exists in fmap. Return 1 on success, 0 on error. */ +int fmap_region_exists(const char *name); + /* Find fmap area name by offset and size. * Return 0 on success, < 0 on error. */ int fmap_find_region_name(const struct region * const ar, diff --git a/src/lib/fmap.c b/src/lib/fmap.c index 9602134..8cb7267 100644 --- a/src/lib/fmap.c +++ b/src/lib/fmap.c @@ -131,6 +131,12 @@ int fmap_locate_area(const char *name, struct region *ar) return -1; }
+int fmap_region_exists(const char *name) +{ + struct region ar; + return !fmap_locate_area(name, &ar); +} + int fmap_find_region_name(const struct region * const ar, char name[FMAP_STRLEN]) {