Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/71620 )
Change subject: internal.c: Add preinit hook ......................................................................
internal.c: Add preinit hook
Change-Id: I9c978e4e74b07a2276f98dcab149ae24b8220c5f Signed-off-by: Edward O'Callaghan quasisec@google.com --- M internal.c 1 file changed, 24 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/20/71620/1
diff --git a/internal.c b/internal.c index cdc6f7b..07b63b4 100644 --- a/internal.c +++ b/internal.c @@ -164,6 +164,19 @@ return 0; }
+static int internal_preinit(struct programmer_cfg *cfg) +{ + /* Unconditionally reset global state from previous operation. */ + laptop_ok = false; + /* Default to Parallel/LPC/FWH flash devices. If a known host controller + * is found, the host controller init routine sets the + * internal_buses_supported bitfield. + */ + internal_buses_supported = BUS_NONSPI; + + return 0; +} + // FIXME: remove '_' suffix once global shadowing is fixed. static void report_nonwl_laptop_detected(int is_laptop_, bool laptop_ok_) { @@ -214,15 +227,6 @@ if (ret) return ret;
- /* Unconditionally reset global state from previous operation. */ - laptop_ok = false; - - /* Default to Parallel/LPC/FWH flash devices. If a known host controller - * is found, the host controller init routine sets the - * internal_buses_supported bitfield. - */ - internal_buses_supported = BUS_NONSPI; - if (try_mtd(cfg) == 0) { ret = 0; goto internal_init_exit; @@ -329,5 +333,6 @@ .name = "internal", .type = OTHER, .devs.note = NULL, + .pre_init = internal_preinit, .init = internal_init, };