diff --git a/src/arch/x86/boot/coreboot_table.c b/src/arch/x86/boot/coreboot_table.c index 530849f0b0..a456484cd3 100644 --- a/src/arch/x86/boot/coreboot_table.c +++ b/src/arch/x86/boot/coreboot_table.c @@ -36,6 +36,7 @@ #endif #if CONFIG_CHROMEOS #include +#include #include #endif @@ -219,7 +220,27 @@ static void lb_vbnv(struct lb_header *header) vbnv->vbnv_start = CONFIG_VBNV_OFFSET + 14; vbnv->vbnv_size = CONFIG_VBNV_SIZE; } -#endif + +#if CONFIG_VBOOT_VERIFY_FIRMWARE +static void lb_vboot_handoff(struct lb_header *header) +{ + void *addr; + uint32_t size; + struct lb_vboot_handoff* vbho; + + if (vboot_get_handoff_info(&addr, &size)) + return; + + vbho = (struct lb_vboot_handoff *)lb_new_record(header); + vbho->tag = LB_TAB_VBOOT_HANDOFF; + vbho->size = sizeof(*vbho); + vbho->vboot_handoff_addr = addr; + vbho->vboot_handoff_size = size; +} +#else +static inline void lb_vboot_handoff(struct lb_header *header) {} +#endif /* CONFIG_VBOOT_VERIFY_FIRMWARE */ +#endif /* CONFIG_CHROMEOS */ static void add_cbmem_pointers(struct lb_header *header) { @@ -697,6 +718,9 @@ unsigned long write_coreboot_table( /* pass along VBNV offsets in CMOS */ lb_vbnv(head); + + /* pass along the vboot_handoff address. */ + lb_vboot_handoff(head); #endif add_cbmem_pointers(head); diff --git a/src/include/boot/coreboot_tables.h b/src/include/boot/coreboot_tables.h index 9cf90d3bc9..71ad3f0477 100644 --- a/src/include/boot/coreboot_tables.h +++ b/src/include/boot/coreboot_tables.h @@ -241,6 +241,15 @@ struct lb_vbnv { uint32_t vbnv_size; }; +#define LB_TAB_VBOOT_HANDOFF 0x0020 +struct lb_vboot_handoff { + uint32_t tag; + uint32_t size; + + void *vboot_handoff_addr; + uint32_t vboot_handoff_size; +}; + /* The following structures are for the cmos definitions table */ #define LB_TAG_CMOS_OPTION_TABLE 200 /* cmos header record */ diff --git a/src/vendorcode/google/chromeos/chromeos.c b/src/vendorcode/google/chromeos/chromeos.c index 559f1f0fdd..abe7104152 100644 --- a/src/vendorcode/google/chromeos/chromeos.c +++ b/src/vendorcode/google/chromeos/chromeos.c @@ -66,4 +66,18 @@ void *vboot_get_payload(int *len) return (void *)fwc->address; } + +int vboot_get_handoff_info(void **addr, uint32_t *size) +{ + struct vboot_handoff *vboot_handoff; + + vboot_handoff = cbmem_find(CBMEM_ID_VBOOT_HANDOFF); + + if (vboot_handoff == NULL) + return -1; + + *addr = vboot_handoff; + *size = sizeof(*vboot_handoff); + return 0; +} #endif diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h index 8410707a9b..d2410857ee 100644 --- a/src/vendorcode/google/chromeos/chromeos.h +++ b/src/vendorcode/google/chromeos/chromeos.h @@ -49,6 +49,8 @@ void init_chromeos(int bootmode); struct romstage_handoff; void vboot_verify_firmware(struct romstage_handoff *handoff); void *vboot_get_payload(int *len); +/* Returns 0 on success < 0 on error. */ +int vboot_get_handoff_info(void **addr, uint32_t *size); #endif #endif