Martin Roth (martinroth@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12574
-gerrit
commit 7137b539d8c145d3488f87fcd4992e50673e8f6d Author: Martin Roth martinroth@google.com Date: Mon Nov 30 09:49:21 2015 -0700
arch/x86/bootblock_normal: Update to use fewer registers
- Move initialization of entry to later in main. - Make boot_mode an unsigned char - no need to use int. - Remove unnecessary variable filenames. - Only get and try to boot fallback once.
Change-Id: I823092c60dd8c2de0a36ec7fdbba3e68f6b7567a Test: compiled. Signed-off-by: Martin Roth martinroth@google.com --- src/arch/x86/bootblock_normal.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/arch/x86/bootblock_normal.c b/src/arch/x86/bootblock_normal.c index d5f03b7..a6a877c 100644 --- a/src/arch/x86/bootblock_normal.c +++ b/src/arch/x86/bootblock_normal.c @@ -10,9 +10,9 @@ static const char *get_fallback(const char *stagelist) {
static void main(unsigned long bist) { - unsigned long entry; - int boot_mode; - const char *default_filenames = "normal/romstage\0fallback/romstage"; + u8 boot_mode; + const char *default_filenames = + "normal/romstage\0fallback/romstage";
if (boot_cpu()) { bootblock_mainboard_init(); @@ -30,22 +30,22 @@ static void main(unsigned long bist) boot_mode = boot_use_normal(cmos_read(RTC_BOOT_BYTE)); }
- char *filenames = (char *)walkcbfs("coreboot-stages"); - if (!filenames) { - filenames = default_filenames; - } - char *normal_candidate = filenames; + char *normal_candidate = (char *)walkcbfs("coreboot-stages");
- if (boot_mode) - entry = findstage(normal_candidate); - else - entry = findstage(get_fallback(normal_candidate)); + if (!normal_candidate) + normal_candidate = default_filenames;
- if (entry) call(entry, bist); + unsigned long entry; + + if (boot_mode) { + entry = findstage(normal_candidate); + if (entry) + call(entry, bist); + }
- /* run fallback if normal can't be found */ entry = findstage(get_fallback(normal_candidate)); - if (entry) call(entry, bist); + if (entry) + call(entry, bist);
/* duh. we're stuck */ halt();