diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index 5d29cf2a9d..41a7f3e0e2 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -179,6 +179,8 @@ typedef struct VbCommonParams { #define VB_INIT_FLAG_OPROM_MATTERS 0x00000100 /* EC on this platform supports EC software sync. */ #define VB_INIT_FLAG_EC_SOFTWARE_SYNC 0x00000200 +/* EC on this platform is slow to update. */ +#define VB_INIT_FLAG_EC_SLOW_UPDATE 0x00000400 /* Output flags for VbInitParams.out_flags. Used to indicate * potential boot paths and configuration to the calling firmware diff --git a/firmware/include/vboot_struct.h b/firmware/include/vboot_struct.h index 4b951b2ab5..f8451a3f2a 100644 --- a/firmware/include/vboot_struct.h +++ b/firmware/include/vboot_struct.h @@ -235,6 +235,8 @@ typedef struct VbKernelPreambleHeader { #define VBSD_HONOR_VIRT_DEV_SWITCH 0x00000400 /* VbInit() was told the system supports EC software sync */ #define VBSD_EC_SOFTWARE_SYNC 0x00000800 +/* VbInit() was told that the EC firmware is slow to update */ +#define VBSD_EC_SLOW_UPDATE 0x00001000 /* Supported flags by header version. It's ok to add new flags while keeping * struct version 2 as long as flag-NOT-present is the correct value for diff --git a/firmware/lib/vboot_api_init.c b/firmware/lib/vboot_api_init.c index dbeb1e66ce..a561890980 100644 --- a/firmware/lib/vboot_api_init.c +++ b/firmware/lib/vboot_api_init.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. +/* Copyright (c) 2012 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. * @@ -61,6 +61,8 @@ VbError_t VbInit(VbCommonParams* cparams, VbInitParams* iparams) { shared->flags |= VBSD_BOOT_RO_NORMAL_SUPPORT; if (iparams->flags & VB_INIT_FLAG_EC_SOFTWARE_SYNC) shared->flags |= VBSD_EC_SOFTWARE_SYNC; + if (iparams->flags & VB_INIT_FLAG_EC_SLOW_UPDATE) + shared->flags |= VBSD_EC_SLOW_UPDATE; is_s3_resume = (iparams->flags & VB_INIT_FLAG_S3_RESUME ? 1 : 0); diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index db82756884..6c68d73b9d 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -437,7 +437,8 @@ static VbError_t EcProtectRW(void) { return rv; } -VbError_t VbEcSoftwareSync(VbSharedDataHeader *shared) { +VbError_t VbEcSoftwareSync(VbCommonParams* cparams) { + VbSharedDataHeader* shared = (VbSharedDataHeader*)cparams->shared_data_blob; int in_rw = 0; int rv; const uint8_t *ec_hash; @@ -455,7 +456,7 @@ VbError_t VbEcSoftwareSync(VbSharedDataHeader *shared) { /* Recovery mode; just verify the EC is in RO code */ if (rv == VBERROR_SUCCESS && in_rw == 1) { /* EC is definitely in RW firmware. We want it in read-only code, so - * preseve the current recovery reason and reboot. + * preserve the current recovery reason and reboot. * * We don't reboot on error or unknown EC code, because we could end * up in an endless reboot loop. If we had some way to track that we'd @@ -569,10 +570,11 @@ VbError_t VbEcSoftwareSync(VbSharedDataHeader *shared) { if (need_update) { VBDEBUG(("VbEcSoftwareSync() updating EC-RW...\n")); - /* - * TODO: need flag passed into VbInit that EC update is slow; if it is, - * display an "updating" screen while the update happens. - */ + if (shared->flags & VBSD_EC_SLOW_UPDATE) { + VBDEBUG(("VbEcSoftwareSync() - EC is slow. Show WAIT screen.\n")); + /* FIXME(crosbug.com/p/12257): Ensure the VGA Option ROM is loaded! */ + VbDisplayScreen(cparams, VB_SCREEN_WAIT, 0, &vnc); + } rv = VbExEcUpdateRW(expected, expected_size); if (rv == VBERROR_EC_REBOOT_TO_RO_REQUIRED) { @@ -642,7 +644,7 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams* cparams, /* Do EC software sync if necessary */ if (shared->flags & VBSD_EC_SOFTWARE_SYNC) { - retval = VbEcSoftwareSync(shared); + retval = VbEcSoftwareSync(cparams); if (retval != VBERROR_SUCCESS) goto VbSelectAndLoadKernel_exit; }