xref: /rk3399_rockchip-uboot/include/android_ab.h (revision aee63dc84c1f5be59ea35ceb209a4ea937bdeb41)
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * SPDX-License-Identifier: BSD-2-Clause
5  */
6 
7 #ifndef __ANDROID_AB_H
8 #define __ANDROID_AB_H
9 
10 #include <common.h>
11 
12 /* Android standard boot slot names are 'a', 'b', 'c', ... */
13 #define ANDROID_BOOT_SLOT_NAME(slot_num) ('a' + (slot_num))
14 
15 /** android_ab_select - Select the slot where to boot from.
16  * On Android devices with more than one boot slot (multiple copies of the
17  * kernel and system images) selects which slot should be used to boot from and
18  * registers the boot attempt. This is used in by the new A/B update model where
19  * one slot is updated in the background while running from the other slot. If
20  * the selected slot did not successfully boot in the past, a boot attempt is
21  * registered before returning from this function so it isn't selected
22  * indefinitely.
23  *
24  * @dev_desc:		Place to store the device description pointer.
25  * @part_info:		Place to store the partition information.
26  * @return the slot number (0-based) on success, or -1 on error.
27  */
28 int android_ab_select(struct blk_desc *dev_desc, disk_partition_t *part_info);
29 
30 #endif
31