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