mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 18:25:10 +00:00
Currently, VB2_DEBUG() will print the function name as a prefix to the
debug output. Add VB2_DEBUG_RAW() to print without that, so that it's
possible to print little bits of debug output. Use this in ec_sync to
hex dump the hashes.
And then clean up all of the debug calls which explicitly did things like:
VB2_DEBUG("%s: foo", __func__);
to just:
VB2_DEBUG("foo");
so they don't double-print the function name
BUG=chromium:683391
BRANCH=none
TEST=build_packages --board=reef chromeos-firmware &&
DEBUG=1 make -j runtests
CQ-DEPEND=CL:430978,CL:431111
Change-Id: I0c35519d2e670d55d65d01eaa60d61f3e3edf419
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/431171
Reviewed-by: Julius Werner <jwerner@chromium.org>
87 lines
2.5 KiB
C
87 lines
2.5 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.
|
|
*
|
|
* EC software sync routines for vboot
|
|
*/
|
|
|
|
#include "2sysincludes.h"
|
|
#include "2common.h"
|
|
#include "2misc.h"
|
|
#include "2nvstorage.h"
|
|
|
|
#include "sysincludes.h"
|
|
#include "ec_sync.h"
|
|
#include "vboot_api.h"
|
|
#include "vboot_common.h"
|
|
#include "vboot_display.h"
|
|
#include "vboot_kernel.h"
|
|
|
|
VbError_t ec_sync_all(struct vb2_context *ctx, struct VbCommonParams *cparams)
|
|
{
|
|
VbSharedDataHeader *shared =
|
|
(VbSharedDataHeader *)cparams->shared_data_blob;
|
|
|
|
/* Do EC sync phase 1; this determines if we need an update */
|
|
VbError_t phase1_rv = ec_sync_phase1(ctx, cparams);
|
|
int need_wait_screen = ec_will_update_slowly(ctx, cparams);
|
|
|
|
/*
|
|
* Check if we need to reboot to load the VGA Option ROM before we can
|
|
* display the WAIT screen.
|
|
*
|
|
* Do this before we check if ec_sync_phase1() requires a reboot for
|
|
* some other reason, since there's no reason to reboot twice.
|
|
*/
|
|
int reboot_for_oprom = (need_wait_screen &&
|
|
shared->flags & VBSD_OPROM_MATTERS &&
|
|
!(shared->flags & VBSD_OPROM_LOADED));
|
|
if (reboot_for_oprom) {
|
|
VB2_DEBUG("Reboot to load VGA Option ROM\n");
|
|
vb2_nv_set(ctx, VB2_NV_OPROM_NEEDED, 1);
|
|
}
|
|
|
|
/* Reboot if phase 1 needed it, or if we need to load VGA Option ROM */
|
|
if (phase1_rv)
|
|
return VBERROR_EC_REBOOT_TO_RO_REQUIRED;
|
|
if (reboot_for_oprom)
|
|
return VBERROR_VGA_OPROM_MISMATCH;
|
|
|
|
/* Display the wait screen if we need it */
|
|
if (need_wait_screen) {
|
|
VB2_DEBUG("EC is slow. Show WAIT screen.\n");
|
|
VbDisplayScreen(ctx, cparams, VB_SCREEN_WAIT, 0);
|
|
}
|
|
|
|
/*
|
|
* Do EC sync phase 2; this applies the update and/or jumps to the
|
|
* correct EC image.
|
|
*/
|
|
VbError_t rv = ec_sync_phase2(ctx, cparams);
|
|
if (rv)
|
|
return rv;
|
|
|
|
/*
|
|
* Reboot to unload VGA Option ROM if:
|
|
* - we displayed the wait screen
|
|
* - the system has slow EC update flag set
|
|
* - the VGA Option ROM was needed and loaded
|
|
* - the system is NOT in developer mode (that'll also need the ROM)
|
|
*/
|
|
if (need_wait_screen &&
|
|
(shared->flags & VBSD_OPROM_MATTERS) &&
|
|
(shared->flags & VBSD_OPROM_LOADED) &&
|
|
!(shared->flags & VBSD_BOOT_DEV_SWITCH_ON)) {
|
|
VB2_DEBUG("Reboot to unload VGA Option ROM\n");
|
|
vb2_nv_set(ctx, VB2_NV_OPROM_NEEDED, 0);
|
|
return VBERROR_VGA_OPROM_MISMATCH;
|
|
}
|
|
|
|
/* Do EC sync phase 3; this completes synd and handles battery cutoff */
|
|
rv = ec_sync_phase3(ctx, cparams);
|
|
if (rv)
|
|
return rv;
|
|
|
|
return VBERROR_SUCCESS;
|
|
}
|