]>
Commit | Line | Data |
---|---|---|
d65e8da9 RT |
1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
2 | /* | |
3 | * Copyright (C) 2017 The Android Open Source Project | |
4 | */ | |
5 | ||
6 | #ifndef __ANDROID_AB_H | |
7 | #define __ANDROID_AB_H | |
8 | ||
e6f6f9e6 SG |
9 | struct blk_desc; |
10 | struct disk_partition; | |
d65e8da9 RT |
11 | |
12 | /* Android standard boot slot names are 'a', 'b', 'c', ... */ | |
13 | #define BOOT_SLOT_NAME(slot_num) ('a' + (slot_num)) | |
14 | ||
15 | /* Number of slots */ | |
16 | #define NUM_SLOTS 2 | |
17 | ||
18 | /** | |
19 | * Select the slot where to boot from. | |
20 | * | |
21 | * On Android devices with more than one boot slot (multiple copies of the | |
22 | * kernel and system images) selects which slot should be used to boot from and | |
23 | * registers the boot attempt. This is used in by the new A/B update model where | |
24 | * one slot is updated in the background while running from the other slot. If | |
25 | * the selected slot did not successfully boot in the past, a boot attempt is | |
26 | * registered before returning from this function so it isn't selected | |
27 | * indefinitely. | |
28 | * | |
29 | * @param[in] dev_desc Place to store the device description pointer | |
30 | * @param[in] part_info Place to store the partition information | |
185f812c | 31 | * Return: The slot number (>= 0) on success, or a negative on error |
d65e8da9 | 32 | */ |
0528979f | 33 | int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info); |
d65e8da9 RT |
34 | |
35 | #endif /* __ANDROID_AB_H */ |