vboot2: implement vb2ex_read_resource
TEST=Built with VBOOT2_VERIFY_FIRMWARE on/off. Booted Nyan Blaze. BUG=None BRANCH=none Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Original-Change-Id: I633f9dddbf8b2f25797aacc246bcebaafb02bea4 Original-Reviewed-on: https://chromium-review.googlesource.com/206063 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Original-Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Original-Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 1f215672de31847cc647e83d2c04633b7f8dfa33) Signed-off-by: Marc Jones <marc.jones@se-eng.com> Change-Id: I57f449b052132b300f7bca4351871c539a7a8694 Reviewed-on: http://review.coreboot.org/8161 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
bcc1d422a2
commit
1989a53ade
|
@ -31,6 +31,23 @@ struct vboot_region {
|
||||||
int32_t size;
|
int32_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void locate_region(const char *name, struct vboot_region *region)
|
||||||
|
{
|
||||||
|
region->size = find_fmap_entry(name, (void **)®ion->offset_addr);
|
||||||
|
VBDEBUG("Located %s @%x\n", name, region->offset_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int is_slot_a(struct vb2_context *ctx)
|
||||||
|
{
|
||||||
|
return !(ctx->flags & VB2_CONTEXT_FW_SLOT_B);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int in_ro(void)
|
||||||
|
{
|
||||||
|
/* TODO: Implement */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* exports */
|
/* exports */
|
||||||
|
|
||||||
void vb2ex_printf(const char *func, const char *fmt, ...)
|
void vb2ex_printf(const char *func, const char *fmt, ...)
|
||||||
|
@ -57,27 +74,29 @@ int vb2ex_read_resource(struct vb2_context *ctx,
|
||||||
void *buf,
|
void *buf,
|
||||||
uint32_t size)
|
uint32_t size)
|
||||||
{
|
{
|
||||||
VBDEBUG("Reading resource\n");
|
struct vboot_region region;
|
||||||
return VB2_ERROR_UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* locals */
|
switch (index) {
|
||||||
|
case VB2_RES_GBB:
|
||||||
|
locate_region("GBB", ®ion);
|
||||||
|
break;
|
||||||
|
case VB2_RES_FW_VBLOCK:
|
||||||
|
if (is_slot_a(ctx))
|
||||||
|
locate_region("VBLOCK_A", ®ion);
|
||||||
|
else
|
||||||
|
locate_region("VBLOCK_B", ®ion);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return VB2_ERROR_EX_READ_RESOURCE_INDEX;
|
||||||
|
}
|
||||||
|
|
||||||
static void locate_region(const char *name, struct vboot_region *region)
|
if (offset + size > region.size)
|
||||||
{
|
return VB2_ERROR_EX_READ_RESOURCE_SIZE;
|
||||||
region->size = find_fmap_entry(name, (void **)®ion->offset_addr);
|
|
||||||
VBDEBUG("Located %s @%x\n", name, region->offset_addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int is_slot_a(struct vb2_context *ctx)
|
if (vboot_get_region(region.offset_addr + offset, size, buf) == NULL)
|
||||||
{
|
return VB2_ERROR_UNKNOWN;
|
||||||
return !(ctx->flags & VB2_CONTEXT_FW_SLOT_B);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int in_ro(void)
|
return VB2_SUCCESS;
|
||||||
{
|
|
||||||
/* TODO: Implement */
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reboot(void)
|
static void reboot(void)
|
||||||
|
|
Loading…
Reference in New Issue