Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved Edward O'Callaghan: Looks good to me, approved Peter Marheine: Looks good to me, but someone else must approve Anastasia Klimchuk: Looks good to me, approved
layout: Introduce get_default_layout()

Containing an included, full-flash-chip sized default region.
This allows us to query the default layout specifically, also
if an additional layout is attached to the flash context.

Change-Id: Ia343e9775ec5bdc3fea5cdb6b347298515996e34
Signed-off-by: Nico Huber <>
Reviewed-by: Edward O'Callaghan <>
Reviewed-by: Angel Pons <>
Reviewed-by: Anastasia Klimchuk <>
Reviewed-by: Peter Marheine <>
Tested-by: build bot (Jenkins) <>
M layout.c
M layout.h
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/layout.c b/layout.c
index ede476a..11df15c 100644
--- a/layout.c
+++ b/layout.c
@@ -33,12 +33,17 @@
return &global_layout;

+const struct flashrom_layout *get_default_layout(const struct flashrom_flashctx *const flashctx)
+ return flashctx->default_layout;
const struct flashrom_layout *get_layout(const struct flashrom_flashctx *const flashctx)
if (flashctx->layout && flashctx->layout->num_entries)
return flashctx->layout;
- return flashctx->default_layout;
+ return get_default_layout(flashctx);

static struct romentry *mutable_layout_next(
diff --git a/layout.h b/layout.h
index c05d1e7..49c1a13 100644
--- a/layout.h
+++ b/layout.h
@@ -58,8 +58,9 @@
struct layout_include_args *next;

-struct flashrom_layout *get_global_layout(void);
struct flashrom_flashctx;
+struct flashrom_layout *get_global_layout(void);
+const struct flashrom_layout *get_default_layout(const struct flashrom_flashctx *);
const struct flashrom_layout *get_layout(const struct flashrom_flashctx *const flashctx);

int get_region_range(struct flashrom_layout *const l, const char *name,

To view, visit change 33519. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ia343e9775ec5bdc3fea5cdb6b347298515996e34
Gerrit-Change-Number: 33519
Gerrit-PatchSet: 10
Gerrit-Owner: Nico Huber <>
Gerrit-Reviewer: Anastasia Klimchuk <>
Gerrit-Reviewer: Angel Pons <>
Gerrit-Reviewer: Arthur Heymans <>
Gerrit-Reviewer: Daniel Campello <>
Gerrit-Reviewer: David Hendricks <>
Gerrit-Reviewer: Edward O'Callaghan <>
Gerrit-Reviewer: Nico Huber <>
Gerrit-Reviewer: Peter Marheine <>
Gerrit-Reviewer: Thomas Heijligen <>
Gerrit-Reviewer: build bot (Jenkins) <>
Gerrit-CC: Paul Menzel <>
Gerrit-MessageType: merged