[coreboot-gerrit] Change in coreboot[master]: lib/fmap: Add hook function.

Philipp Deppenwiese (Code Review) gerrit at coreboot.org
Fri Mar 2 02:42:34 CET 2018


Philipp Deppenwiese has uploaded this change for review. ( https://review.coreboot.org/24966


Change subject: lib/fmap: Add hook function.
......................................................................

lib/fmap: Add hook function.

* Add hook function for accessing rdev by
  calling locate functions.

Change-Id: I699eec879e2c61976832c394b70cd6cfa5bae584
Signed-off-by: zaolin <zaolin at das-labor.org>
---
M src/include/fmap.h
M src/lib/fmap.c
2 files changed, 20 insertions(+), 2 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/66/24966/1

diff --git a/src/include/fmap.h b/src/include/fmap.h
index 5834831..300f962 100644
--- a/src/include/fmap.h
+++ b/src/include/fmap.h
@@ -19,6 +19,9 @@
 #include <commonlib/region.h>
 #include <commonlib/fmap_serialized.h>
 
+/* Hook function for access to rdev in locate functions */
+void hook_fmap_rdev(const char *name, const struct region_device *area);
+
 /* Locate the fmap directory. Return 0 on success, < 0 on error. */
 int find_fmap_directory(struct region_device *fmrd);
 
diff --git a/src/lib/fmap.c b/src/lib/fmap.c
index 9602134..e4231e0 100644
--- a/src/lib/fmap.c
+++ b/src/lib/fmap.c
@@ -29,6 +29,11 @@
 
 static int fmap_print_once CAR_GLOBAL;
 
+void __attribute__((weak))
+hook_fmap_rdev(const char *name, const struct region_device *area)
+{
+}
+
 int find_fmap_directory(struct region_device *fmrd)
 {
 	const struct region_device *boot;
@@ -77,7 +82,12 @@
 	if (fmap_locate_area(name, &ar))
 		return -1;
 
-	return boot_device_ro_subregion(&ar, area);
+	if (boot_device_ro_subregion(&ar, area))
+		return -1;
+
+	hook_fmap_rdev(name, area);
+
+	return 0;
 }
 
 int fmap_locate_area_as_rdev_rw(const char *name, struct region_device *area)
@@ -87,7 +97,12 @@
 	if (fmap_locate_area(name, &ar))
 		return -1;
 
-	return boot_device_rw_subregion(&ar, area);
+	if (boot_device_rw_subregion(&ar, area))
+		return -1;
+
+	hook_fmap_rdev(name, area);
+
+	return 0;
 }
 
 int fmap_locate_area(const char *name, struct region *ar)

-- 
To view, visit https://review.coreboot.org/24966
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I699eec879e2c61976832c394b70cd6cfa5bae584
Gerrit-Change-Number: 24966
Gerrit-PatchSet: 1
Gerrit-Owner: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180302/463b34c1/attachment.html>


More information about the coreboot-gerrit mailing list