mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
layout: Rework normalize_romentries() API
Rename it to layout_sanity_checks() as that is what it does and let it work on the currently active layout instead of the global layout. Change-Id: Ifae3480d4bd68c939c291f05734544e93f00306c Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/54285 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
e03a5f7d5d
commit
7f48053172
1
flash.h
1
flash.h
@ -420,7 +420,6 @@ __attribute__((format(printf, 2, 3)));
|
|||||||
/* layout.c */
|
/* layout.c */
|
||||||
int register_include_arg(struct layout_include_args **args, const char *arg);
|
int register_include_arg(struct layout_include_args **args, const char *arg);
|
||||||
int read_romlayout(const char *name);
|
int read_romlayout(const char *name);
|
||||||
int normalize_romentries(const struct flashctx *flash);
|
|
||||||
void layout_cleanup(struct layout_include_args **args);
|
void layout_cleanup(struct layout_include_args **args);
|
||||||
|
|
||||||
/* spi.c */
|
/* spi.c */
|
||||||
|
@ -1865,7 +1865,7 @@ int prepare_flash_access(struct flashctx *const flash,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flash->layout == get_global_layout() && normalize_romentries(flash)) {
|
if (layout_sanity_checks(flash)) {
|
||||||
msg_cerr("Requested regions can not be handled. Aborting.\n");
|
msg_cerr("Requested regions can not be handled. Aborting.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
7
layout.c
7
layout.c
@ -298,11 +298,10 @@ void layout_cleanup(struct layout_include_args **args)
|
|||||||
flashrom_layout_release(layout);
|
flashrom_layout_release(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validate and - if needed - normalize layout entries. */
|
int layout_sanity_checks(const struct flashrom_flashctx *const flash)
|
||||||
int normalize_romentries(const struct flashctx *flash)
|
|
||||||
{
|
{
|
||||||
struct flashrom_layout *const layout = get_global_layout();
|
const struct flashrom_layout *const layout = get_layout(flash);
|
||||||
chipsize_t total_size = flash->chip->total_size * 1024;
|
const chipsize_t total_size = flash->chip->total_size * 1024;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
const struct romentry *entry = NULL;
|
const struct romentry *entry = NULL;
|
||||||
|
1
layout.h
1
layout.h
@ -62,5 +62,6 @@ const struct romentry *layout_next_included(const struct flashrom_layout *, cons
|
|||||||
const struct romentry *layout_next(const struct flashrom_layout *, const struct romentry *);
|
const struct romentry *layout_next(const struct flashrom_layout *, const struct romentry *);
|
||||||
int included_regions_overlap(const struct flashrom_layout *const flashrom_layout);
|
int included_regions_overlap(const struct flashrom_layout *const flashrom_layout);
|
||||||
void prepare_layout_for_extraction(struct flashrom_flashctx *flash);
|
void prepare_layout_for_extraction(struct flashrom_flashctx *flash);
|
||||||
|
int layout_sanity_checks(const struct flashrom_flashctx *);
|
||||||
|
|
||||||
#endif /* !__LAYOUT_H__ */
|
#endif /* !__LAYOUT_H__ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user