vboot: allow for dynamic work buffers
The vboot library currently relies on link-time known address and sizes of the work buffer. Not all platforms can provide such semantics. Therefore, add an option to use cbmem for the work buffer. This implies such platforms can only do verification of the firmware after main memory has been initialized. Change-Id: If0b0f6b2a187b5c1fb56af08b6cb384a935be096 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/10157 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
parent
1e8be636cc
commit
0e571fd7ac
|
@ -84,6 +84,7 @@
|
||||||
#define CBMEM_ID_STAGEx_CACHE 0x57a9e100
|
#define CBMEM_ID_STAGEx_CACHE 0x57a9e100
|
||||||
#define CBMEM_ID_TIMESTAMP 0x54494d45
|
#define CBMEM_ID_TIMESTAMP 0x54494d45
|
||||||
#define CBMEM_ID_VBOOT_HANDOFF 0x780074f0
|
#define CBMEM_ID_VBOOT_HANDOFF 0x780074f0
|
||||||
|
#define CBMEM_ID_VBOOT_WORKBUF 0x78007343
|
||||||
#define CBMEM_ID_WIFI_CALIBRATION 0x57494649
|
#define CBMEM_ID_WIFI_CALIBRATION 0x57494649
|
||||||
|
|
||||||
#ifndef __ASSEMBLER__
|
#ifndef __ASSEMBLER__
|
||||||
|
@ -128,6 +129,7 @@
|
||||||
{ CBMEM_ID_SPINTABLE, "SPIN TABLE " }, \
|
{ CBMEM_ID_SPINTABLE, "SPIN TABLE " }, \
|
||||||
{ CBMEM_ID_TIMESTAMP, "TIME STAMP " }, \
|
{ CBMEM_ID_TIMESTAMP, "TIME STAMP " }, \
|
||||||
{ CBMEM_ID_VBOOT_HANDOFF, "VBOOT " }, \
|
{ CBMEM_ID_VBOOT_HANDOFF, "VBOOT " }, \
|
||||||
|
{ CBMEM_ID_VBOOT_WORKBUF, "VBOOT WORK " }, \
|
||||||
{ CBMEM_ID_WIFI_CALIBRATION, "WIFI CLBR " },
|
{ CBMEM_ID_WIFI_CALIBRATION, "WIFI CLBR " },
|
||||||
|
|
||||||
struct cbmem_entry;
|
struct cbmem_entry;
|
||||||
|
|
|
@ -101,3 +101,13 @@ config VBOOT_BOOT_LOADER_INDEX
|
||||||
help
|
help
|
||||||
This is the index of the bootloader component in the verified
|
This is the index of the bootloader component in the verified
|
||||||
firmware block.
|
firmware block.
|
||||||
|
|
||||||
|
config VBOOT_DYNAMIC_WORK_BUFFER
|
||||||
|
bool "Vboot's work buffer is dynamically allocated."
|
||||||
|
default n
|
||||||
|
depends on VBOOT_VERIFY_FIRMWARE
|
||||||
|
help
|
||||||
|
This option is used when there isn't enough pre-main memory
|
||||||
|
ram to allocate the vboot work buffer. That means vboot verification
|
||||||
|
is after memory init and requires main memory to back the work
|
||||||
|
buffer.
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cbfs.h>
|
#include <cbfs.h>
|
||||||
|
#include <cbmem.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <reset.h>
|
#include <reset.h>
|
||||||
#include "../chromeos.h"
|
#include "../chromeos.h"
|
||||||
|
@ -25,13 +26,22 @@
|
||||||
#include "../vboot_handoff.h"
|
#include "../vboot_handoff.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
|
static const size_t vb_work_buf_size = 16 * KiB;
|
||||||
|
|
||||||
struct vb2_working_data * const vboot_get_working_data(void)
|
struct vb2_working_data * const vboot_get_working_data(void)
|
||||||
{
|
{
|
||||||
|
if (IS_ENABLED(CONFIG_VBOOT_DYNAMIC_WORK_BUFFER))
|
||||||
|
/* cbmem_add() does a cbmem_find() first. */
|
||||||
|
return cbmem_add(CBMEM_ID_VBOOT_WORKBUF, vb_work_buf_size);
|
||||||
|
else
|
||||||
return (struct vb2_working_data *)_vboot2_work;
|
return (struct vb2_working_data *)_vboot2_work;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t vb2_working_data_size(void)
|
size_t vb2_working_data_size(void)
|
||||||
{
|
{
|
||||||
|
if (IS_ENABLED(CONFIG_VBOOT_DYNAMIC_WORK_BUFFER))
|
||||||
|
return vb_work_buf_size;
|
||||||
|
else
|
||||||
return _vboot2_work_size;
|
return _vboot2_work_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue