Beispiel #1
0
void run_ramstage(void)
{
	struct prog ramstage =
		PROG_INIT(ASSET_RAMSTAGE, CONFIG_CBFS_PREFIX "/ramstage");

	/* Only x86 systems currently take the same firmware path on resume. */
	if (IS_ENABLED(CONFIG_ARCH_X86) && IS_ENABLED(CONFIG_EARLY_CBMEM_INIT))
		run_ramstage_from_resume(romstage_handoff_find_or_add(),
						&ramstage);

	if (prog_locate(&ramstage))
		goto fail;

	timestamp_add_now(TS_START_COPYRAM);

	if (IS_ENABLED(CONFIG_RELOCATABLE_RAMSTAGE)) {
		if (load_relocatable_ramstage(&ramstage))
			goto fail;
	} else if (cbfs_prog_stage_load(&ramstage))
		goto fail;

	stage_cache_add(STAGE_RAMSTAGE, &ramstage);

	timestamp_add_now(TS_END_COPYRAM);

	prog_run(&ramstage);

fail:
	die("Ramstage was not loaded!\n");
}
void run_ramstage(void)
{
	struct romstage_handoff *handoff;
	const struct prog_loader_ops *ops;
	int i;
	struct prog ramstage = {
		.name = CONFIG_CBFS_PREFIX "/ramstage",
		.type = PROG_RAMSTAGE,
	};

	handoff = romstage_handoff_find_or_add();

	run_ramstage_from_resume(handoff, &ramstage);

	for (i = 0; i < ARRAY_SIZE(loaders); i++) {
		ops = loaders[i];
		printk(BIOS_DEBUG, "Trying %s ramstage loader.\n", ops->name);
		load_ramstage(ops, handoff, &ramstage);
	}

	die("Ramstage was not loaded!\n");
}