aboutsummaryrefslogtreecommitdiff
path: root/src/lib/loaders/load_and_run_romstage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/loaders/load_and_run_romstage.c')
-rw-r--r--src/lib/loaders/load_and_run_romstage.c42
1 files changed, 42 insertions, 0 deletions
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);
+}