Exemplo n.º 1
0
static void vboot_prepare(void)
{
    int run_verification;

    run_verification = verification_should_run();

    if (run_verification) {
        verstage_main();
        car_set_var(vboot_executed, 1);
    } else if (verstage_should_load()) {
        struct cbfsf file;
        struct prog verstage =
            PROG_INIT(PROG_VERSTAGE,
                      CONFIG_CBFS_PREFIX "/verstage");

        printk(BIOS_DEBUG, "VBOOT: Loading verstage.\n");

        /* load verstage from RO */
        if (cbfs_boot_locate(&file, prog_name(&verstage), NULL))
            die("failed to load verstage");

        cbfs_file_data(prog_rdev(&verstage), &file);

        if (cbfs_prog_stage_load(&verstage))
            die("failed to load verstage");

        /* verify and select a slot */
        prog_run(&verstage);

        /* This is not actually possible to hit this condition at
         * runtime, but this provides a hint to the compiler for dead
         * code elimination below. */
        if (!IS_ENABLED(CONFIG_RETURN_FROM_VERSTAGE))
            return;

        car_set_var(vboot_executed, 1);
    }

    /*
     * Fill in vboot cbmem objects before moving to ramstage so all
     * downstream users have access to vboot results. This path only
     * applies to platforms employing VBOOT_DYNAMIC_WORK_BUFFER because
     * cbmem comes online prior to vboot verification taking place. For
     * other platforms the vboot cbmem objects are initialized when
     * cbmem comes online.
     */
    if (ENV_ROMSTAGE && IS_ENABLED(CONFIG_VBOOT_DYNAMIC_WORK_BUFFER)) {
        vb2_store_selected_region();
        vboot_fill_handoff();
    }
}
Exemplo n.º 2
0
static void vb2_store_selected_region_cbmem(int unused)
{
	vb2_store_selected_region();
}
Exemplo n.º 3
0
static void vboot_prepare(void)
{
	if (verification_should_run()) {
		/* Note: this path is not used for VBOOT_RETURN_FROM_VERSTAGE */
		verstage_main();
		car_set_var(vboot_executed, 1);
		vb2_save_recovery_reason_vbnv();

		/*
		 * Avoid double memory retrain when the EC is running RW code
		 * and a recovery request came in through an EC host event. The
		 * double retrain happens because the EC won't be rebooted
		 * until kernel verification notices the EC isn't running RO
		 * code which is after memory training. Therefore, reboot the
		 * EC after we've saved the potential recovery request so it's
		 * not lost. Lastly, only perform this sequence on x86
		 * platforms since those are the ones that currently do a
		 * costly memory training in recovery mode.
		 */
		if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC) &&
			IS_ENABLED(CONFIG_ARCH_X86))
			google_chromeec_early_init();

	} else if (verstage_should_load()) {
		struct cbfsf file;
		struct prog verstage =
			PROG_INIT(PROG_VERSTAGE,
				CONFIG_CBFS_PREFIX "/verstage");

		printk(BIOS_DEBUG, "VBOOT: Loading verstage.\n");

		/* load verstage from RO */
		if (cbfs_boot_locate(&file, prog_name(&verstage), NULL))
			die("failed to load verstage");

		cbfs_file_data(prog_rdev(&verstage), &file);

		if (cbfs_prog_stage_load(&verstage))
			die("failed to load verstage");

		/* verify and select a slot */
		prog_run(&verstage);

		/* This is not actually possible to hit this condition at
		 * runtime, but this provides a hint to the compiler for dead
		 * code elimination below. */
		if (!IS_ENABLED(CONFIG_VBOOT_RETURN_FROM_VERSTAGE))
			return;

		car_set_var(vboot_executed, 1);
	}

	/*
	 * Fill in vboot cbmem objects before moving to ramstage so all
	 * downstream users have access to vboot results. This path only
	 * applies to platforms employing VBOOT_STARTS_IN_ROMSTAGE because
	 * cbmem comes online prior to vboot verification taking place. For
	 * other platforms the vboot cbmem objects are initialized when
	 * cbmem comes online.
	 */
	if (ENV_ROMSTAGE && IS_ENABLED(CONFIG_VBOOT_STARTS_IN_ROMSTAGE)) {
		vb2_store_selected_region();
		vboot_fill_handoff();
	}
}