void vboot_fill_handoff(void) { struct vboot_handoff *vh; struct vb2_shared_data *sd; sd = vb2_get_shared_data(); sd->workbuf_hash_offset = 0; sd->workbuf_hash_size = 0; printk(BIOS_INFO, "creating vboot_handoff structure\n"); vh = cbmem_add(CBMEM_ID_VBOOT_HANDOFF, sizeof(*vh)); if (vh == NULL) /* we don't need to failover gracefully here because this * shouldn't happen with the image that has passed QA. */ die("failed to allocate vboot_handoff structure\n"); memset(vh, 0, sizeof(*vh)); /* needed until we finish transtion to vboot2 for kernel verification */ fill_vboot_handoff(vh, sd); /* * The recovery mode switch is cleared (typically backed by EC) here * to allow multiple queries to get_recovery_mode_switch() and have * them return consistent results during the verified boot path as well * as dram initialization. x86 systems ignore the saved dram settings * in the recovery path in order to start from a clean slate. Therefore * clear the state here since this function is called when memory * is known to be up. */ clear_recovery_mode_switch(); }
static int vb2_get_recovery_reason_shared_data(void) { /* Shared data does not exist for Ramstage and Post-CAR stage. */ if (ENV_RAMSTAGE || ENV_POSTCAR) return 0; struct vb2_shared_data *sd = vb2_get_shared_data(); assert(sd); return sd->recovery_reason; }
void vb2_init_work_context(struct vb2_context *ctx) { struct vb2_working_data *wd; size_t work_size; /* First initialize the working data region. */ work_size = vb2_working_data_size(); wd = vboot_get_working_data(); memset(wd, 0, work_size); /* * vboot prefers 16-byte alignment. This takes away 16 bytes * from the VBOOT2_WORK region, but the vboot devs said that's okay. */ wd->buffer_offset = ALIGN_UP(sizeof(*wd), 16); wd->buffer_size = work_size - wd->buffer_offset; /* Initialize the vb2_context. */ memset(ctx, 0, sizeof(*ctx)); ctx->workbuf = (void *)vb2_get_shared_data(); ctx->workbuf_size = wd->buffer_size; }