mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 10:00:51 +00:00
This is done at RO stage. If the rollback region is unprotected, update
it to match the version in the RW image.
If the rollback region is protected, we can't do that update, so we wait
for RW to unlock that region (presumably after AP has verified that image
is somewhat functional) before updating it.
BRANCH=none
BUG=b:35586219
TEST=flashwp true; reboot => hammer reboots twice
flashinfo shows RO+rollback protected:
Flags: wp_gpio_asserted ro_at_boot ro_now rollback_at_boot rollback_now
Protected now:
YYYYYYYY YYYYYYYY Y....... ........
TEST=Hack version.c to add "+1" to rollback_version, check that RO updates
ROLLBACK info block on first boot.
TEST=Use hack above, convert rwsig to separate task, add 5000 ms delay in
rwsig just before rollback information is updated. Then:
Quickly type: flashwp true; reboot; flashwp all; reboot
=> Wait for system to jump to RW
rollbackinfo => minimum version 0
flashwp norb; reboot; wait for jump to RW
rollbackinfo => minimum version 1
Change-Id: I78e502315c611c5edaf34b8d70a12fedd3e57bdf
Reviewed-on: https://chromium-review.googlesource.com/452816
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
40 lines
962 B
C
40 lines
962 B
C
/* Copyright 2017 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.
|
|
*/
|
|
|
|
#ifndef __CROS_EC_ROLLBACK_H
|
|
#define __CROS_EC_ROLLBACK_H
|
|
|
|
#define CROS_EC_ROLLBACK_COOKIE 0x0b112233
|
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
/**
|
|
* Get minimum version set by rollback protection blocks.
|
|
*
|
|
* @return Minimum rollback version, 0 if neither block is initialized,
|
|
* negative value on error.
|
|
*/
|
|
int rollback_get_minimum_version(void);
|
|
|
|
/**
|
|
* Update rollback protection block to the version passed as parameter.
|
|
*
|
|
* @param next_min_version Minimum version to write in rollback block.
|
|
*
|
|
* @return EC_SUCCESS on success, EC_ERROR_* on error.
|
|
*/
|
|
int rollback_update(int32_t next_min_version);
|
|
|
|
/**
|
|
* Lock rollback protection block, reboot if necessary.
|
|
*
|
|
* @return EC_SUCCESS if rollback was already protected.
|
|
*/
|
|
int rollback_lock(void);
|
|
|
|
#endif
|
|
|
|
#endif /* __CROS_EC_ROLLBACK_H */
|