static int do_bootstage_stash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { ulong base, size; int ret; if (get_base_size(argc, argv, &base, &size)) return CMD_RET_USAGE; if (base == -1UL) { printf("No bootstage stash area defined\n"); return 1; } if (0 == strcmp(argv[0], "stash")) ret = bootstage_stash((void *)base, size); else ret = bootstage_unstash((void *)base, size); if (ret) return 1; return 0; }
/* Record the board_init_f() bootstage (after arch_cpu_init()) */ static int initf_bootstage(void) { bool from_spl = IS_ENABLED(CONFIG_SPL_BOOTSTAGE) && IS_ENABLED(CONFIG_BOOTSTAGE_STASH); int ret; ret = bootstage_init(!from_spl); if (ret) return ret; if (from_spl) { const void *stash = map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR, CONFIG_BOOTSTAGE_STASH_SIZE); ret = bootstage_unstash(stash, CONFIG_BOOTSTAGE_STASH_SIZE); if (ret && ret != -ENOENT) { debug("Failed to unstash bootstage: err=%d\n", ret); return ret; } } bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f"); return 0; }
static uint32_t twostop_main_firmware(struct twostop_fmap *fmap, void *gbb, crossystem_data_t *cdata, void *vb_shared_data) { VbError_t err; VbSelectAndLoadKernelParams kparams; VbCommonParams cparams; size_t size = 0; #ifdef CONFIG_BOOTSTAGE_STASH bootstage_unstash((void *)CONFIG_BOOTSTAGE_STASH, CONFIG_BOOTSTAGE_STASH_SIZE); #endif bootstage_mark_name(BOOTSTAGE_VBOOT_TWOSTOP_MAIN_FIRMWARE, "twostop_main_firmware"); if (twostop_init_cparams(fmap, gbb, vb_shared_data, &cparams)) { VBDEBUG("failed to init cparams\n"); return TWOSTOP_SELECT_ERROR; } /* * Note that in case "kernel" is not found in the device tree, the * "size" value is going to remain unchanged. */ kparams.kernel_buffer = cros_fdtdec_alloc_region(gd->fdt_blob, "kernel", &size); kparams.kernel_buffer_size = size; VBDEBUG("kparams:\n"); VBDEBUG("- kernel_buffer: : %p\n", kparams.kernel_buffer); VBDEBUG("- kernel_buffer_size: : %08x\n", kparams.kernel_buffer_size); #ifdef CONFIG_EXYNOS_DISPLAYPORT /* * Make sure the LCD is up before we load the kernel. Partly this * is because VbSelectAndLoadKernel may do a software sync. */ exynos_lcd_check_next_stage(gd->fdt_blob, 1); #endif if ((err = VbSelectAndLoadKernel(&cparams, &kparams))) { VBDEBUG("VbSelectAndLoadKernel: %d\n", err); switch (err) { case VBERROR_SHUTDOWN_REQUESTED: return TWOSTOP_SELECT_POWER_OFF; case VBERROR_BIOS_SHELL_REQUESTED: return TWOSTOP_SELECT_COMMAND_LINE; case VBERROR_EC_REBOOT_TO_RO_REQUIRED: request_ec_reboot_to_ro(); return TWOSTOP_SELECT_POWER_OFF; } return TWOSTOP_SELECT_ERROR; } VBDEBUG("kparams:\n"); VBDEBUG("- kernel_buffer: : %p\n", kparams.kernel_buffer); VBDEBUG("- kernel_buffer_size: : %08x\n", kparams.kernel_buffer_size); VBDEBUG("- disk_handle: : %p\n", kparams.disk_handle); VBDEBUG("- partition_number: : %08x\n", kparams.partition_number); VBDEBUG("- bootloader_address: : %08llx\n", kparams.bootloader_address); VBDEBUG("- bootloader_size: : %08x\n", kparams.bootloader_size); VBDEBUG("- partition_guid: :"); #ifdef VBOOT_DEBUG int i; for (i = 0; i < 16; i++) VbExDebug(" %02x", kparams.partition_guid[i]); VbExDebug("\n"); #endif /* VBOOT_DEBUG */ /* EC might jump between RO and RW during software sync. We need to * update active EC copy in cdata. */ set_active_ec_firmware(cdata); crossystem_data_dump(cdata); #if defined(CONFIG_SANDBOX) return TWOSTOP_SELECT_COMMAND_LINE; #else boot_kernel(&kparams, cdata); /* It is an error if boot_kenel returns */ return TWOSTOP_SELECT_ERROR; #endif }