drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / src / arch / x86 / bootblock_normal.c
blob4bc9b013328c440fa80357244e342602c928dc92
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <cbfs.h>
4 #include <fallback.h>
5 #include <program_loading.h>
6 #include <stddef.h>
8 static const char *get_fallback(const char *stagelist)
10 while (*stagelist)
11 stagelist++;
12 return ++stagelist;
15 enum cb_err legacy_romstage_select_and_load(struct prog *romstage)
17 static const char *default_filenames = "normal/romstage\0fallback/romstage";
18 const char *boot_candidate;
19 size_t stages_len;
21 boot_candidate = cbfs_map("coreboot-stages", &stages_len);
22 if (!boot_candidate)
23 boot_candidate = default_filenames;
25 if (do_normal_boot()) {
26 romstage->name = boot_candidate;
27 if (cbfs_prog_stage_load(romstage) == CB_SUCCESS)
28 return CB_SUCCESS;
31 romstage->name = get_fallback(boot_candidate);
32 return cbfs_prog_stage_load(romstage);