xref: /rk3399_rockchip-uboot/include/spl_ab.h (revision 13ceb2afdcb6f5114908e39f0d2453728eb24e0f)
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 /**
59  * Append ab slot info to bootargs
60  *
61  * @param fdt		FDT address in memory
62  * @param slot		slot info
63  * @return 0 if ok, else error
64  */
65 int spl_ab_bootargs_append_slot(void *fdt, char *slot);
66 
67  #endif
68