summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-03-17 13:17:06 -0500
committerAaron Durbin <adurbin@google.com>2015-03-20 19:27:47 +0100
commitd1b0e87179ca42eadbfb36191171e0e8552c1cbe (patch)
tree2f246909f2f57e3393c7439b72e4af5ae08a5a89 /src
parent6bb6a1a79c2ee1bd14b10e7c1fdbca98516d0ef9 (diff)
downloadcoreboot-d1b0e87179ca42eadbfb36191171e0e8552c1cbe.tar.xz
loaders: add run_romstage() function to bootblock
Provide a common run_romstage() function to be used by bootblocks to load and run romstage. This is similar to run_ramstage() in that it provides a single entry point for doing the necessary work of loading and running romstage. Change-Id: Ia9643cc091f97a836cf5caefdff8df4a3443df4c Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/8709 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/include/program_loading.h6
-rw-r--r--src/lib/loaders/Makefile.inc1
-rw-r--r--src/lib/loaders/load_and_run_romstage.c42
3 files changed, 49 insertions, 0 deletions
diff --git a/src/include/program_loading.h b/src/include/program_loading.h
index 8ceebc12d4..32f80e1f34 100644
--- a/src/include/program_loading.h
+++ b/src/include/program_loading.h
@@ -22,6 +22,12 @@
#include <stdint.h>
#include <stddef.h>
+/************************
+ * ROMSTAGE LOADING *
+ ************************/
+
+/* Run romstage from bootblock. */
+void run_romstage(void);
/************************
* RAMSTAGE LOADING *
diff --git a/src/lib/loaders/Makefile.inc b/src/lib/loaders/Makefile.inc
index 356e47e328..71d9c44507 100644
--- a/src/lib/loaders/Makefile.inc
+++ b/src/lib/loaders/Makefile.inc
@@ -17,6 +17,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
+bootblock-y += load_and_run_romstage.c
romstage-y += cbfs_ramstage_loader.c
romstage-y += load_and_run_ramstage.c
ramstage-y += cbfs_payload_loader.c
diff --git a/src/lib/loaders/load_and_run_romstage.c b/src/lib/loaders/load_and_run_romstage.c
new file mode 100644
index 0000000000..ebc1243594
--- /dev/null
+++ b/src/lib/loaders/load_and_run_romstage.c
@@ -0,0 +1,42 @@
+/*
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include <stdlib.h>
+#include <console/console.h>
+#include <arch/stages.h>
+#include <cbfs.h>
+#include <halt.h>
+#include <program_loading.h>
+
+void run_romstage(void)
+{
+ void *entry;
+
+ entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA,
+ CONFIG_CBFS_PREFIX "/romstage");
+
+ if (entry == (void *)-1) {
+ if (IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE))
+ die("Couldn't load romstage.\n");
+ halt();
+ }
+
+ stage_exit(entry);
+}