Files
OpenCellular/chip/g/system_chip.h
Vadim Bendebury 855ac13224 cr50: add rollback information to the sysinfo command output
With enabling INFO1 map based rollback protection it is important to
be able to tell the state of the flash map and the currently installed
images' infomap header field.

The new function counts number of zero words in the info map and zero
bits in both RW headers, and returns them in a string printed out by
the sysinfo command.

BRANCH=cr50
BUG=b:35774863
TEST=built images with different manifest info field contents and
     verified that the string printed by the sysinfo command makes sense.

Change-Id: If633a6c678dc34197b2dad116b6180b2d549e089
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/450905
Reviewed-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-03-09 03:24:01 -08:00

72 lines
2.0 KiB
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.
*/
/* chip/g-specific system function prototypes */
#ifndef __CROS_EC_SYSTEM_CHIP_H
#define __CROS_EC_SYSTEM_CHIP_H
/**
* On systems with protection from a failing RW update: read the retry counter
* and act on it.
*
* @return EC_SUCCESS if no flash write errors were encounterd.
*/
int system_process_retry_counter(void);
/**
* On systems with protection from a failing RW update: reset retry
* counter, this is used after a new image upload is finished, to make
* sure that the new image has a chance to run.
*/
void system_clear_retry_counter(void);
/**
* A function provided by some platforms to decrement a retry counter.
*
* This should be used whenever a system reset is manually triggered.
*/
void system_decrement_retry_counter(void);
/**
* A function provided by some platforms to hint that something is going
* wrong.
*
* @return a boolean, set to True if rolling reboot condition is suspected.
*/
int system_rolling_reboot_suspected(void);
/**
* Compare the rw headers to check if there was a rollback.
*
* @return a boolean, set to True if a rollback is detected.
*/
int system_rollback_detected(void);
/**
* Returns non-zero value when firmware is expected to be abe to detect user
* request to cut off battery supply.
*/
int system_battery_cutoff_support_required(void);
/**
* Modify info1 RW rollback mask to match currently executing RW image's
* header.
*/
void system_update_rollback_mask(void);
/*
**
* Scan INFO1 rollback map and infomap fields of both RW and RW_B image
* headers, and return a string showing how many zeros are there at the base
* of in each of these objects.
*
* The passed in parameters are the memory area to put the string in and the
* size of this memory area.
*/
void system_get_rollback_bits(char *value, size_t value_size);
#endif /* __CROS_EC_SYSTEM_CHIP_H */