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 /* Number of slots */
16 #define ANDROID_NUM_SLOTS 2
17 
18 /** android_ab_select - Select the slot where to boot from.
19  * On Android devices with more than one boot slot (multiple copies of the
20  * kernel and system images) selects which slot should be used to boot from and
21  * registers the boot attempt. This is used in by the new A/B update model where
22  * one slot is updated in the background while running from the other slot. If
23  * the selected slot did not successfully boot in the past, a boot attempt is
24  * registered before returning from this function so it isn't selected
25  * indefinitely.
26  *
27  * @dev_desc:		Place to store the device description pointer.
28  * @part_info:		Place to store the partition information.
29  * @return the slot number (0-based) on success, or -1 on error.
30  */
31 int android_ab_select(struct blk_desc *dev_desc, disk_partition_t *part_info);
32 
33 #endif
34