aboutsummaryrefslogtreecommitdiff
path: root/src/lib/loaders
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/loaders')
-rw-r--r--src/lib/loaders/Makefile.inc27
-rw-r--r--src/lib/loaders/cbfs_payload_loader.c43
-rw-r--r--src/lib/loaders/cbfs_ramstage_loader.c56
-rw-r--r--src/lib/loaders/cbfs_romstage_loader.c31
-rw-r--r--src/lib/loaders/load_and_run_payload.c118
-rw-r--r--src/lib/loaders/load_and_run_ramstage.c109
-rw-r--r--src/lib/loaders/load_and_run_romstage.c85
7 files changed, 0 insertions, 469 deletions
diff --git a/src/lib/loaders/Makefile.inc b/src/lib/loaders/Makefile.inc
deleted file mode 100644
index ef5af6a7aa..0000000000
--- a/src/lib/loaders/Makefile.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# This file is part of the coreboot project.
-#
-# Copyright (C) 2014 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.
-#
-
-bootblock-y += load_and_run_romstage.c
-bootblock-y += cbfs_romstage_loader.c
-romstage-y += cbfs_ramstage_loader.c
-romstage-y += load_and_run_ramstage.c
-ramstage-y += cbfs_payload_loader.c
-ramstage-y += load_and_run_payload.c
-verstage-y += cbfs_romstage_loader.c
-verstage-y += load_and_run_romstage.c
diff --git a/src/lib/loaders/cbfs_payload_loader.c b/src/lib/loaders/cbfs_payload_loader.c
deleted file mode 100644
index 8e790a2952..0000000000
--- a/src/lib/loaders/cbfs_payload_loader.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2014 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_locate_payload(struct prog *payload)
-{
- void *buffer;
- size_t size;
- const int type = CBFS_TYPE_PAYLOAD;
-
- buffer = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, payload->name,
- type, &size);
-
- if (buffer == NULL)
- return -1;
-
- prog_set_area(payload, buffer, size);
-
- return 0;
-}
-
-const struct prog_loader_ops cbfs_payload_loader = {
- .name = "CBFS",
- .prepare = cbfs_locate_payload,
-};
diff --git a/src/lib/loaders/cbfs_ramstage_loader.c b/src/lib/loaders/cbfs_ramstage_loader.c
deleted file mode 100644
index acbc6c0afe..0000000000
--- a/src/lib/loaders/cbfs_ramstage_loader.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2008-2009 coresystems GmbH
- * Copyright (C) 2014 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 <console/console.h>
-#include <cbfs.h>
-#include <program_loading.h>
-
-#if CONFIG_RELOCATABLE_RAMSTAGE
-#include <rmodule.h>
-#include <cbmem.h>
-
-static int cbfs_load_ramstage(struct prog *ramstage)
-{
- struct rmod_stage_load rmod_ram = {
- .cbmem_id = CBMEM_ID_RAMSTAGE,
- .prog = ramstage,
- };
-
- if (rmodule_stage_load_from_cbfs(&rmod_ram)) {
- printk(BIOS_DEBUG, "Could not load ramstage.\n");
- return -1;
- }
-
- return 0;
-}
-
-#else /* CONFIG_RELOCATABLE_RAMSTAGE */
-
-static int cbfs_load_ramstage(struct prog *ramstage)
-{
- return cbfs_load_prog_stage(CBFS_DEFAULT_MEDIA, ramstage);
-
-}
-
-#endif /* CONFIG_RELOCATABLE_RAMSTAGE */
-
-const struct prog_loader_ops cbfs_ramstage_loader = {
- .name = "CBFS",
- .prepare = cbfs_load_ramstage,
-};
diff --git a/src/lib/loaders/cbfs_romstage_loader.c b/src/lib/loaders/cbfs_romstage_loader.c
deleted file mode 100644
index e5b42158f8..0000000000
--- a/src/lib/loaders/cbfs_romstage_loader.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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,
-};
diff --git a/src/lib/loaders/load_and_run_payload.c b/src/lib/loaders/load_and_run_payload.c
deleted file mode 100644
index 6616110319..0000000000
--- a/src/lib/loaders/load_and_run_payload.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2014 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 <stdint.h>
-#include <stdlib.h>
-#include <cbmem.h>
-#include <console/console.h>
-#include <fallback.h>
-#include <lib.h>
-#include <program_loading.h>
-#include <symbols.h>
-#include <timestamp.h>
-
-extern const struct prog_loader_ops vboot_loader;
-extern const struct prog_loader_ops cbfs_payload_loader;
-
-static const struct prog_loader_ops *payload_ops[] = {
-#if CONFIG_VBOOT_VERIFY_FIRMWARE
- &vboot_loader,
-#endif
- &cbfs_payload_loader,
-};
-
-static struct prog global_payload = {
- .name = CONFIG_CBFS_PREFIX "/payload",
- .type = PROG_PAYLOAD,
-};
-
-void __attribute__((weak)) mirror_payload(struct prog *payload)
-{
- return;
-}
-
-void payload_load(void)
-{
- int i;
- const struct prog_loader_ops *ops;
- struct prog *payload = &global_payload;
-
- for (i = 0; i < ARRAY_SIZE(payload_ops); i++) {
- /* Default loader state is active. */
- int ret = 1;
-
- ops = payload_ops[i];
-
- if (ops->is_loader_active != NULL)
- ret = ops->is_loader_active(payload);
-
- if (ret == 0) {
- printk(BIOS_DEBUG, "%s payload loader inactive.\n",
- ops->name);
- continue;
- } else if (ret < 0) {
- printk(BIOS_DEBUG, "%s payload loader failure.\n",
- ops->name);
- continue;
- }
-
- if (ops->prepare(payload) < 0) {
- printk(BIOS_DEBUG, "%s: could not locate payload.\n",
- ops->name);
- continue;
- }
- printk(BIOS_DEBUG, "%s: located payload @ %p, %zu bytes.\n",
- ops->name, prog_start(payload), prog_size(payload));
- break;
- }
-
- if (i == ARRAY_SIZE(payload_ops))
- goto out;
-
- mirror_payload(payload);
-
- /* Pass cbtables to payload if architecture desires it. */
- prog_set_entry(payload, selfload(payload),
- cbmem_find(CBMEM_ID_CBTABLE));
-
-out:
- if (prog_entry(payload) == NULL)
- die("Payload not loaded.\n");
-}
-
-void payload_run(void)
-{
- struct prog *payload = &global_payload;
-
- /* Reset to booting from this image as late as possible */
- boot_successful();
-
- printk(BIOS_DEBUG, "Jumping to boot code at %p(%p)\n",
- prog_entry(payload), prog_entry_arg(payload));
- post_code(POST_ENTER_ELF_BOOT);
-
- timestamp_add_now(TS_SELFBOOT_JUMP);
-
- /* Before we go off to run the payload, see if
- * we stayed within our bounds.
- */
- checkstack(_estack, 0);
-
- prog_run(payload);
-}
diff --git a/src/lib/loaders/load_and_run_ramstage.c b/src/lib/loaders/load_and_run_ramstage.c
deleted file mode 100644
index 47637b85fc..0000000000
--- a/src/lib/loaders/load_and_run_ramstage.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2014 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 <stdlib.h>
-#include <console/console.h>
-#include <arch/stages.h>
-#include <cbfs.h>
-#include <program_loading.h>
-#include <romstage_handoff.h>
-#include <stage_cache.h>
-#include <timestamp.h>
-
-extern const struct prog_loader_ops cbfs_ramstage_loader;
-extern const struct prog_loader_ops vboot_loader;
-
-static const struct prog_loader_ops *loaders[] = {
-#if CONFIG_VBOOT_VERIFY_FIRMWARE
- &vboot_loader,
-#endif
- &cbfs_ramstage_loader,
-};
-
-void __attribute__((weak)) stage_cache_add(int stage_id, struct prog *stage) {}
-void __attribute__((weak)) stage_cache_load_stage(int stage_id,
- struct prog *stage) {}
-void __attribute__((weak)) ramstage_cache_invalid(void) {}
-
-static void load_ramstage(const struct prog_loader_ops *ops,
- struct prog *ramstage)
-{
- timestamp_add_now(TS_START_COPYRAM);
-
- if (ops->prepare(ramstage))
- return;
-
- stage_cache_add(STAGE_RAMSTAGE, ramstage);
-
- timestamp_add_now(TS_END_COPYRAM);
-
- prog_run(ramstage);
-}
-
-static void run_ramstage_from_resume(struct romstage_handoff *handoff,
- struct prog *ramstage)
-{
- if (handoff != NULL && handoff->s3_resume) {
- /* Load the cached ramstage to runtime location. */
- stage_cache_load_stage(STAGE_RAMSTAGE, ramstage);
-
- if (prog_entry(ramstage) != NULL) {
- printk(BIOS_DEBUG, "Jumping to image.\n");
- prog_run(ramstage);
- }
- ramstage_cache_invalid();
- }
-}
-
-void run_ramstage(void)
-{
- const struct prog_loader_ops *ops;
- int i;
- struct prog ramstage = {
- .name = CONFIG_CBFS_PREFIX "/ramstage",
- .type = PROG_RAMSTAGE,
- };
-
- run_ramstage_from_resume(romstage_handoff_find_or_add(), &ramstage);
-
- for (i = 0; i < ARRAY_SIZE(loaders); i++) {
- /* Default loader state is active. */
- int ret = 1;
-
- ops = loaders[i];
-
- if (ops->is_loader_active != NULL)
- ret = ops->is_loader_active(&ramstage);
-
- if (ret == 0) {
- printk(BIOS_DEBUG, "%s ramstage loader inactive.\n",
- ops->name);
- continue;
- } else if (ret < 0) {
- printk(BIOS_DEBUG, "%s ramstage loader failure.\n",
- ops->name);
- continue;
- }
-
- printk(BIOS_DEBUG, "%s ramstage loader active.\n", ops->name);
- load_ramstage(ops, &ramstage);
- }
-
- die("Ramstage was not loaded!\n");
-}
diff --git a/src/lib/loaders/load_and_run_romstage.c b/src/lib/loaders/load_and_run_romstage.c
deleted file mode 100644
index dfcb8597dc..0000000000
--- a/src/lib/loaders/load_and_run_romstage.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 <stdlib.h>
-#include <console/console.h>
-#include <arch/stages.h>
-#include <cbfs.h>
-#include <halt.h>
-#include <program_loading.h>
-#include <rules.h>
-#include <timestamp.h>
-
-extern const struct prog_loader_ops cbfs_romstage_loader;
-extern const struct prog_loader_ops vboot_loader;
-
-static const struct prog_loader_ops *loaders[] = {
-#if CONFIG_VBOOT_VERIFY_FIRMWARE
- &vboot_loader,
-#endif
-#if !ENV_VERSTAGE || (ENV_VERSTAGE && !CONFIG_RETURN_FROM_VERSTAGE)
- &cbfs_romstage_loader,
-#endif
-};
-
-void run_romstage(void)
-{
- int i;
- struct prog romstage = {
- .name = CONFIG_CBFS_PREFIX "/romstage",
- .type = PROG_ROMSTAGE,
- };
-
- for (i = 0; i < ARRAY_SIZE(loaders); i++) {
- /* Default loader state is active. */
- int ret = 1;
- const struct prog_loader_ops *ops;
-
- ops = loaders[i];
-
- if (ops->is_loader_active != NULL)
- ret = ops->is_loader_active(&romstage);
-
- if (ret == 0) {
- printk(BIOS_DEBUG, "%s romstage loader inactive.\n",
- ops->name);
- continue;
- } else if (ret < 0) {
- printk(BIOS_DEBUG, "%s romstage loader failure.\n",
- ops->name);
- continue;
- }
-
- printk(BIOS_DEBUG, "%s romstage loader active.\n", ops->name);
-
- timestamp_add_now(TS_START_COPYROM);
-
- if (ops->prepare(&romstage))
- continue;
-
- timestamp_add_now(TS_END_COPYROM);
-
- prog_run(&romstage);
- }
-
- if (IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE))
- die("Couldn't load romstage.\n");
- halt();
-}