xref: /rk3399_rockchip-uboot/include/android_bootloader.h (revision 67dac67453c08a760320a21ccd076abd47c9c9f1)
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * SPDX-License-Identifier: BSD-2-Clause
5  */
6 
7 #ifndef __ANDROID_BOOTLOADER_H
8 #define __ANDROID_BOOTLOADER_H
9 
10 #include <common.h>
11 
12 enum android_boot_mode {
13 	ANDROID_BOOT_MODE_NORMAL = 0,
14 
15 	/* "recovery" mode is triggered by the "reboot recovery" command or
16 	 * equivalent adb/fastboot command. It can also be triggered by writing
17 	 * "boot-recovery" in the BCB message. This mode should boot the
18 	 * recovery kernel.
19 	 */
20 	ANDROID_BOOT_MODE_RECOVERY,
21 
22 	/* "bootloader" mode is triggered by the "reboot bootloader" command or
23 	 * equivalent adb/fastboot command. It can also be triggered by writing
24 	 * "bootonce-bootloader" in the BCB message. This mode should boot into
25 	 * fastboot.
26 	 */
27 	ANDROID_BOOT_MODE_BOOTLOADER,
28 };
29 
30 /** android_bootloader_boot_flow - Execute the Android Bootloader Flow.
31  * Performs the Android Bootloader boot flow, loading the appropriate Android
32  * image (normal kernel, recovery kernel or "bootloader" mode) and booting it.
33  * The boot mode is determined by the contents of the Android Bootloader
34  * Message. On success it doesn't return.
35  *
36  * @return a negative number in case of error, otherwise it doesn't return.
37  */
38 int android_bootloader_boot_flow(struct blk_desc *dev_desc,
39 				 const disk_partition_t *misc_part_info,
40 				 unsigned long kernel_address);
41 
42 #endif  /* __ANDROID_BOOTLOADER_H */
43