romstages: use common run_ramstage()

Instead of sprinkling the cbfs calls around (as well as getting
return values incorrect) use the common run_ramstage() to perform
the necessary work to load and run ramstage.

Change-Id: I37b1e94be36ef7a43efe65b2db110742fa105169
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/8710
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Aaron Durbin 2015-03-17 13:25:19 -05:00 committed by Aaron Durbin
parent d1b0e87179
commit e4f3e7a9c6
11 changed files with 22 additions and 70 deletions

View File

@ -16,6 +16,7 @@
#include <cpu/allwinner/a10/clock.h>
#include <cpu/allwinner/a10/gpio.h>
#include <cpu/allwinner/a10/twi.h>
#include <program_loading.h>
#define __SIMPLE_DEVICE__
#include <device/device.h>
#include <drivers/xpowers/axp209/axp209.h>
@ -70,7 +71,6 @@ static enum cb_err cubieboard_setup_power(void)
void main(void)
{
void *entry;
enum cb_err err;
console_init();
@ -87,8 +87,5 @@ void main(void)
a1x_set_cpu_clock(384);
}
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/ramstage");
printk(BIOS_INFO, "entry is 0x%p, leaving romstage.\n", entry);
stage_exit(entry);
run_ramstage();
}

View File

@ -13,17 +13,11 @@
* GNU General Public License for more details.
*/
#include <cbfs.h>
#include <console/console.h>
#include <arch/stages.h>
#include <program_loading.h>
void main(void)
{
void *entry;
console_init();
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/ramstage");
stage_exit(entry);
run_ramstage();
}

View File

@ -13,17 +13,11 @@
* GNU General Public License for more details.
*/
#include <cbfs.h>
#include <console/console.h>
#include <arch/stages.h>
#include <program_loading.h>
void main(void)
{
void *entry;
console_init();
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, CONFIG_CBFS_PREFIX"/ramstage");
stage_exit(entry);
run_ramstage();
}

View File

@ -37,7 +37,7 @@
#include <soc/samsung/exynos5250/trustzone.h>
#include <soc/samsung/exynos5250/wakeup.h>
#include <console/console.h>
#include <arch/stages.h>
#include <program_loading.h>
#include <drivers/maxim/max77686/max77686.h>
#include <device/i2c.h>
@ -145,7 +145,6 @@ static struct mem_timings *setup_clock(void)
void main(void)
{
struct mem_timings *mem;
void *entry;
int is_resume = (get_wakeup_state() != IS_NOT_WAKEUP);
timestamp_init(timestamp_get());
@ -182,9 +181,7 @@ void main(void)
cbmem_initialize_empty();
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/ramstage");
timestamp_add_now(TS_END_ROMSTAGE);
stage_exit(entry);
run_ramstage();
}

View File

@ -21,11 +21,11 @@
#include <arch/cpu.h>
#include <arch/exception.h>
#include <arch/io.h>
#include <arch/stages.h>
#include <cbfs.h>
#include <cbmem.h>
#include <console/console.h>
#include <mainboard/google/nyan/reset.h>
#include <program_loading.h>
#include <romstage_handoff.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "sdram_configs.h"
@ -201,12 +201,7 @@ static void __attribute__((noinline)) romstage(void)
vboot_verify_firmware(romstage_handoff_find_or_add());
timestamp_add_now(TS_START_COPYRAM);
void *entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA,
"fallback/coreboot_ram");
timestamp_add_now(TS_END_COPYRAM);
stage_exit(entry);
run_ramstage();
}
/* Stub to force arm_init_caches to the top, before any stack/memory accesses */

View File

@ -21,11 +21,11 @@
#include <arch/cpu.h>
#include <arch/exception.h>
#include <arch/io.h>
#include <arch/stages.h>
#include <cbfs.h>
#include <cbmem.h>
#include <console/console.h>
#include <mainboard/google/nyan/reset.h>
#include <program_loading.h>
#include <romstage_handoff.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "sdram_configs.h"
@ -201,12 +201,7 @@ static void __attribute__((noinline)) romstage(void)
vboot_verify_firmware(romstage_handoff_find_or_add());
timestamp_add_now(TS_START_COPYRAM);
void *entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA,
"fallback/coreboot_ram");
timestamp_add_now(TS_END_COPYRAM);
stage_exit(entry);
run_ramstage();
}
/* Stub to force arm_init_caches to the top, before any stack/memory accesses */

View File

@ -21,11 +21,11 @@
#include <arch/cpu.h>
#include <arch/exception.h>
#include <arch/io.h>
#include <arch/stages.h>
#include <cbfs.h>
#include <cbmem.h>
#include <console/console.h>
#include <mainboard/google/nyan/reset.h>
#include <program_loading.h>
#include <romstage_handoff.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "sdram_configs.h"
@ -205,12 +205,7 @@ static void __attribute__((noinline)) romstage(void)
vboot_verify_firmware(romstage_handoff_find_or_add());
#endif
timestamp_add_now(TS_START_COPYRAM);
void *entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA,
"fallback/coreboot_ram");
timestamp_add_now(TS_END_COPYRAM);
stage_exit(entry);
run_ramstage();
}
/* Stub to force arm_init_caches to the top, before any stack/memory accesses */

View File

@ -38,7 +38,7 @@
#include <soc/samsung/exynos5420/trustzone.h>
#include <soc/samsung/exynos5420/wakeup.h>
#include <console/console.h>
#include <arch/stages.h>
#include <program_loading.h>
#include <drivers/maxim/max77802/max77802.h>
#include <device/i2c.h>
@ -228,7 +228,6 @@ void main(void)
{
extern struct mem_timings mem_timings;
void *entry;
int is_resume = (get_wakeup_state() != IS_NOT_WAKEUP);
int power_init_failed;
@ -278,10 +277,9 @@ void main(void)
cbmem_initialize_empty();
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/ramstage");
simple_spi_test();
timestamp_add_now(TS_END_ROMSTAGE);
stage_exit(entry);
run_ramstage();
}

View File

@ -17,18 +17,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <arch/stages.h>
#include <cbfs.h>
#include <cbmem.h>
#include <console/console.h>
#include <program_loading.h>
void main(void)
{
void *entry;
console_init();
cbmem_initialize_empty();
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/coreboot_ram");
stage_exit(entry);
run_ramstage();
}

View File

@ -21,17 +21,15 @@
#include <armv7.h>
#include <cbfs.h>
#include <console/console.h>
#include <arch/stages.h>
#include <cbmem.h>
#include <delay.h>
#include <program_loading.h>
#include <timestamp.h>
#include <arch/cache.h>
#include <arch/exception.h>
void main(void)
{
void *entry;
console_init();
/* used for MMU and CBMEM setup, in MB */
@ -54,6 +52,5 @@ void main(void)
cbmem_initialize_empty();
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/ramstage");
stage_exit(entry);
run_ramstage();
}

View File

@ -22,18 +22,13 @@
#include <armv7.h>
#include <cbfs.h>
#include <arch/stages.h>
#include <program_loading.h>
#include <console/console.h>
void main(void)
{
void *entry;
console_init();
printk(BIOS_INFO, "Hello from romstage.\n");
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/ramstage");
printk(BIOS_INFO, "entry is 0x%p, leaving romstage.\n", entry);
stage_exit(entry);
run_ramstage();
}