167dac674SAlex Deymo /* 267dac674SAlex Deymo * Copyright (C) 2016 The Android Open Source Project 367dac674SAlex Deymo * 467dac674SAlex Deymo * SPDX-License-Identifier: BSD-2-Clause 567dac674SAlex Deymo */ 667dac674SAlex Deymo 767dac674SAlex Deymo #ifndef __ANDROID_BOOTLOADER_H 867dac674SAlex Deymo #define __ANDROID_BOOTLOADER_H 967dac674SAlex Deymo 1067dac674SAlex Deymo #include <common.h> 1167dac674SAlex Deymo 1267dac674SAlex Deymo enum android_boot_mode { 1367dac674SAlex Deymo ANDROID_BOOT_MODE_NORMAL = 0, 1467dac674SAlex Deymo 1567dac674SAlex Deymo /* "recovery" mode is triggered by the "reboot recovery" command or 1667dac674SAlex Deymo * equivalent adb/fastboot command. It can also be triggered by writing 1767dac674SAlex Deymo * "boot-recovery" in the BCB message. This mode should boot the 1867dac674SAlex Deymo * recovery kernel. 1967dac674SAlex Deymo */ 2067dac674SAlex Deymo ANDROID_BOOT_MODE_RECOVERY, 2167dac674SAlex Deymo 2267dac674SAlex Deymo /* "bootloader" mode is triggered by the "reboot bootloader" command or 2367dac674SAlex Deymo * equivalent adb/fastboot command. It can also be triggered by writing 2467dac674SAlex Deymo * "bootonce-bootloader" in the BCB message. This mode should boot into 2567dac674SAlex Deymo * fastboot. 2667dac674SAlex Deymo */ 2767dac674SAlex Deymo ANDROID_BOOT_MODE_BOOTLOADER, 2867dac674SAlex Deymo }; 2967dac674SAlex Deymo 3067dac674SAlex Deymo /** android_bootloader_boot_flow - Execute the Android Bootloader Flow. 3167dac674SAlex Deymo * Performs the Android Bootloader boot flow, loading the appropriate Android 3267dac674SAlex Deymo * image (normal kernel, recovery kernel or "bootloader" mode) and booting it. 3367dac674SAlex Deymo * The boot mode is determined by the contents of the Android Bootloader 3467dac674SAlex Deymo * Message. On success it doesn't return. 3567dac674SAlex Deymo * 36*80622240SAlex Deymo * @dev_desc: device where to load the kernel and system to boot from. 37*80622240SAlex Deymo * @misc_part_info: the "misc" partition descriptor in 'dev_desc'. 38*80622240SAlex Deymo * @slot: the boot slot to boot from. 39*80622240SAlex Deymo * @kernel_address: address where to load the kernel if needed. 40*80622240SAlex Deymo * 4167dac674SAlex Deymo * @return a negative number in case of error, otherwise it doesn't return. 4267dac674SAlex Deymo */ 4367dac674SAlex Deymo int android_bootloader_boot_flow(struct blk_desc *dev_desc, 4467dac674SAlex Deymo const disk_partition_t *misc_part_info, 45*80622240SAlex Deymo const char *slot, 4667dac674SAlex Deymo unsigned long kernel_address); 4767dac674SAlex Deymo 4867dac674SAlex Deymo #endif /* __ANDROID_BOOTLOADER_H */ 49