Move get_layout() from flashrom.c to layout.c
Change-Id: Ic67cf53abddc0aa905674acbcde717d9aed2f66e
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/21367
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/layout.c b/layout.c
index 9bf0b03..7ce7c57 100644
--- a/layout.c
+++ b/layout.c
@@ -40,6 +40,14 @@
return &layout;
}
+const struct flashrom_layout *get_layout(const struct flashrom_flashctx *const flashctx)
+{
+ if (flashctx->layout && flashctx->layout->num_entries)
+ return flashctx->layout;
+ else
+ return &flashctx->fallback_layout.base;
+}
+
#ifndef __LIBPAYLOAD__
int read_romlayout(const char *name)
{