1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

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 <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/33519
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nico Huber 2019-06-16 03:22:58 +02:00
parent c32c8dc8af
commit a630a56413
2 changed files with 8 additions and 2 deletions

View File

@ -33,12 +33,17 @@ struct flashrom_layout *get_global_layout(void)
return &global_layout; 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) const struct flashrom_layout *get_layout(const struct flashrom_flashctx *const flashctx)
{ {
if (flashctx->layout && flashctx->layout->num_entries) if (flashctx->layout && flashctx->layout->num_entries)
return flashctx->layout; return flashctx->layout;
else else
return flashctx->default_layout; return get_default_layout(flashctx);
} }
static struct romentry *mutable_layout_next( static struct romentry *mutable_layout_next(

View File

@ -58,8 +58,9 @@ struct layout_include_args {
struct layout_include_args *next; struct layout_include_args *next;
}; };
struct flashrom_layout *get_global_layout(void);
struct flashrom_flashctx; 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); const struct flashrom_layout *get_layout(const struct flashrom_flashctx *const flashctx);
int get_region_range(struct flashrom_layout *const l, const char *name, int get_region_range(struct flashrom_layout *const l, const char *name,