Home | History | Annotate | Download | only in include
      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  * @dev_desc:		device where to load the kernel and system to boot from.
     37  * @misc_part_info:	the "misc" partition descriptor in 'dev_desc'.
     38  * @slot:		the boot slot to boot from.
     39  * @kernel_address:	address where to load the kernel if needed.
     40  *
     41  * @return a negative number in case of error, otherwise it doesn't return.
     42  */
     43 int android_bootloader_boot_flow(struct blk_desc *dev_desc,
     44 				 const disk_partition_t *misc_part_info,
     45 				 const char *slot,
     46 				 unsigned long kernel_address);
     47 
     48 #endif  /* __ANDROID_BOOTLOADER_H */
     49