coreboot: add a place to choose romstage loader
Instead of always loading romstage from cbfs provide a way, similar to ramstage and payload, for other program loaders to intervene. For now, only the cbfs loader is consulted. TEST=Booted to end of ramstage on qemu-armv7 Change-Id: I87c3e2e566d7a0723e775aa427de58af745ecdd5 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9934 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <edward.ocallaghan@koparo.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
13d45aa928
commit
69cb2c2b5e
|
@ -18,6 +18,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
bootblock-y += load_and_run_romstage.c
|
bootblock-y += load_and_run_romstage.c
|
||||||
|
bootblock-y += cbfs_romstage_loader.c
|
||||||
romstage-y += cbfs_ramstage_loader.c
|
romstage-y += cbfs_ramstage_loader.c
|
||||||
romstage-y += load_and_run_ramstage.c
|
romstage-y += load_and_run_ramstage.c
|
||||||
ramstage-y += cbfs_payload_loader.c
|
ramstage-y += cbfs_payload_loader.c
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the coreboot project.
|
||||||
|
*
|
||||||
|
* Copyright 2015 Google Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; version 2 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cbfs.h>
|
||||||
|
#include <program_loading.h>
|
||||||
|
|
||||||
|
static int cbfs_load_romstage(struct prog *romstage)
|
||||||
|
{
|
||||||
|
return cbfs_load_prog_stage(CBFS_DEFAULT_MEDIA, romstage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const struct prog_loader_ops cbfs_romstage_loader = {
|
||||||
|
.name = "CBFS",
|
||||||
|
.prepare = cbfs_load_romstage,
|
||||||
|
};
|
|
@ -26,20 +26,38 @@
|
||||||
#include <program_loading.h>
|
#include <program_loading.h>
|
||||||
#include <timestamp.h>
|
#include <timestamp.h>
|
||||||
|
|
||||||
|
extern const struct prog_loader_ops cbfs_romstage_loader;
|
||||||
|
|
||||||
|
static const struct prog_loader_ops *loaders[] = {
|
||||||
|
&cbfs_romstage_loader,
|
||||||
|
};
|
||||||
|
|
||||||
void run_romstage(void)
|
void run_romstage(void)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
struct prog romstage = {
|
struct prog romstage = {
|
||||||
.name = CONFIG_CBFS_PREFIX "/romstage",
|
.name = CONFIG_CBFS_PREFIX "/romstage",
|
||||||
.type = PROG_ROMSTAGE,
|
.type = PROG_ROMSTAGE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(loaders); i++) {
|
||||||
|
const struct prog_loader_ops *ops;
|
||||||
|
|
||||||
|
ops = loaders[i];
|
||||||
|
|
||||||
|
printk(BIOS_DEBUG, "Trying %s romstage loader.\n", ops->name);
|
||||||
|
|
||||||
timestamp_add_now(TS_START_COPYROM);
|
timestamp_add_now(TS_START_COPYROM);
|
||||||
if (cbfs_load_prog_stage(CBFS_DEFAULT_MEDIA, &romstage) < 0) {
|
|
||||||
if (IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE))
|
if (ops->prepare(&romstage))
|
||||||
die("Couldn't load romstage.\n");
|
continue;
|
||||||
halt();
|
|
||||||
}
|
|
||||||
timestamp_add_now(TS_END_COPYROM);
|
timestamp_add_now(TS_END_COPYROM);
|
||||||
|
|
||||||
prog_run(&romstage);
|
prog_run(&romstage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE))
|
||||||
|
die("Couldn't load romstage.\n");
|
||||||
|
halt();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue