Files
OpenCellular/firmware/lib/vboot_common_init.c
Simon Glass 981cb2acdc Enable vboot for sandbox and improve debugging/format strings
Some functions of vboot are disabled for sandbox because sandbox could not
support them. This has changed, so remove the sandbox #ifdefs in the code.

Some printf() strings cause warnings on sandbox - mostly that uin64_t is
not 'long long' on a 64-bit machine. The existing format strings in U-Boot
do not seem to take account of this, so add casts to remove the warnings.

Also add a few more debug strings to make it easier to see what is happening
in the vboot flow.

BUG=chrome-os-partner:21115
BRANCH=pit
TEST=manual
crosfw -b sandbox -V

See there are no warnings.

Change-Id: I86f90a693e4bd23fcacf6d48297dd32229348dd4
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65621
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-08-24 09:37:48 -07:00

46 lines
1.2 KiB
C

/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Common functions between firmware and kernel verified boot.
* (Firmware portion)
*/
#include "sysincludes.h"
#include "vboot_api.h"
#include "vboot_common.h"
#include "utility.h"
int VbSharedDataInit(VbSharedDataHeader *header, uint64_t size)
{
VBDEBUG(("VbSharedDataInit, %d bytes, header %d bytes\n", (int)size,
(int)sizeof(VbSharedDataHeader)));
if (size < sizeof(VbSharedDataHeader)) {
VBDEBUG(("Not enough data for header.\n"));
return VBOOT_SHARED_DATA_INVALID;
}
if (size < VB_SHARED_DATA_MIN_SIZE) {
VBDEBUG(("Shared data buffer too small.\n"));
return VBOOT_SHARED_DATA_INVALID;
}
if (!header)
return VBOOT_SHARED_DATA_INVALID;
/* Zero the header */
Memset(header, 0, sizeof(VbSharedDataHeader));
/* Initialize fields */
header->magic = VB_SHARED_DATA_MAGIC;
header->struct_version = VB_SHARED_DATA_VERSION;
header->struct_size = sizeof(VbSharedDataHeader);
header->data_size = size;
header->data_used = sizeof(VbSharedDataHeader);
header->firmware_index = 0xFF;
/* Success */
return VBOOT_SUCCESS;
}