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