summaryrefslogtreecommitdiff
path: root/include/system.h
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2017-08-15 16:34:52 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-09-21 01:07:55 -0700
commit729a4ba2bdc20675e24ed9e7d0a98d19934d72f8 (patch)
treee6096452677021e40378d7e50aaa722a9257c048 /include/system.h
parent60b77099e0b7a0bd40e7504c2752091c378a2f1d (diff)
downloadchrome-ec-729a4ba2bdc20675e24ed9e7d0a98d19934d72f8.tar.gz
EFS: Switch active slot when current slot is invalid
When EFS finds the active slot is invalid, it tries the other slot. This patch makes the other slot active so that the following boots will try the other slot first. This patch also replaces enum flash_rw_slot with system_image_copy_t. The new APIs are therefore renamed from *_slot to *_copy. Basically, this makes vboot see slots as a conceptual place instead of physical spaces bound to flash storage. BUG=b:65028930 BRANCH=none TEST=On Fizz, verify: 1. RW_B is old and updated by soft sync. RW_B is activated and executed after reboot. System continues to boot to OS. 2. RW_A is old and updated by soft sync. RW_A is activated and executed after reboot. System continues to boot to OS. Change-Id: Icf97da13e651e7a931b9d507052b9422566eb16c Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/648449
Diffstat (limited to 'include/system.h')
-rw-r--r--include/system.h37
1 files changed, 28 insertions, 9 deletions
diff --git a/include/system.h b/include/system.h
index d44cb315b1..0d94fc0fe0 100644
--- a/include/system.h
+++ b/include/system.h
@@ -562,18 +562,37 @@ static inline void system_print_extended_version_info(void)
*/
int system_can_boot_ap(void);
-enum flash_rw_slot {
- /* Must be 0 and 1 because they are converted by 1 - slot_x. */
- FLASH_RW_SLOT_A = 0,
- FLASH_RW_SLOT_B = 1,
-};
+/**
+ * Get active image copy
+ *
+ * Active slot contains an image which is being executed or will be executed
+ * after sysjump.
+ *
+ * @return Active copy index
+ */
+enum system_image_copy_t system_get_active_copy(void);
+
+/**
+ * Get updatable (non-active) image copy
+ *
+ * @return Updatable copy index
+ */
+enum system_image_copy_t system_get_update_copy(void);
+
+/**
+ * Set active image copy
+ *
+ * @param copy Copy id to be activated.
+ * @return Non-zero if error.
+ */
+int system_set_active_copy(enum system_image_copy_t copy);
/**
- * Get flash offset of a RW slot
+ * Get flash offset of a RW copy
*
- * @param slot Slot index to get the flash offset of.
- * @return Flash offset of the slot specified by <slot>
+ * @param copy Copy index to get the flash offset of.
+ * @return Flash offset of the slot storing <copy>
*/
-uint32_t flash_get_rw_offset(enum flash_rw_slot slot);
+uint32_t flash_get_rw_offset(enum system_image_copy_t copy);
#endif /* __CROS_EC_SYSTEM_H */