xref: /OK3568_Linux_fs/u-boot/include/spl_ab.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier:     GPL-2.0+ */
2 /*
3  * (C) Copyright 2019 Rockchip Electronics Co., Ltd
4  */
5 
6 #ifndef _SPL_AB_H_
7 #define _SPL_AB_H_
8 
9 #include <spl.h>
10 #include <android_avb/libavb_ab.h>
11 #include <android_avb/avb_ab_flow.h>
12 
13 #define AB_METADATA_OFFSET 4
14 
15 /*
16  * spl_get_current_slot
17  *
18  * @dev_desc: block description
19  * @partition: partition name
20  * @slot: A/B slot
21  *
22  * return: 0 success, others fail.
23  */
24 int spl_get_current_slot(struct blk_desc *dev_desc, char *partition,
25 			 char *slot);
26 
27 /*
28  * spl_ab_append_part_slot
29  *
30  * @dev_desc: block description
31  * @part_name: partition name
32  * @new_name: append the slot suffix
33  *
34  * return: 0 success, others fail.
35  */
36 int spl_ab_append_part_slot(struct blk_desc *dev_desc,
37 			    const char *part_name,
38 			    char *new_name);
39 
40 /*
41  * spl_ab_decrease_tries
42  *
43  * @dev_desc: block description
44  *
45  * return: 0 success, others fail.
46  */
47 int spl_ab_decrease_tries(struct blk_desc *dev_desc);
48 
49 /*
50  * spl_ab_decrease_reset
51  *
52  * @dev_desc: block description
53  *
54  * return: 0 success, others fail.
55  */
56 int spl_ab_decrease_reset(struct blk_desc *dev_desc);
57 
58  #endif
59