static int bldr_handshake(struct bldr_command_handler *handler) { boot_mode_t mode = 0; bool isSBC = 0; #ifdef MTK_SECURITY_SW_SUPPORT /* get mode type */ mode = seclib_brom_meta_mode(); isSBC = seclib_sbc_enabled(); BOOTING_TIME_PROFILING_LOG("seclib_brom_meta_mode"); #endif switch (mode) { case NORMAL_BOOT: /* ------------------------- */ /* security check */ /* ------------------------- */ if (TRUE == isSBC) { handler->attr |= CMD_HNDL_ATTR_COM_FORBIDDEN; print("%s META DIS\n", MOD); } #if CFG_USB_TOOL_HANDSHAKE platform_pmic_full_reset_disable(); if (TRUE == usb_handshake(handler)) g_meta_com_type = META_USB_COM; platform_pmic_full_reset_enable(); BOOTING_TIME_PROFILING_LOG("USB handshake"); #endif #if CFG_UART_TOOL_HANDSHAKE if (TRUE == uart_handshake(handler)) g_meta_com_type = META_UART_COM; BOOTING_TIME_PROFILING_LOG("UART handshake"); #endif break; case META_BOOT: print("%s BR META BOOT\n", MOD); g_boot_mode = META_BOOT; if(!usb_cable_in()) g_meta_com_type = META_UART_COM; else g_meta_com_type = META_USB_COM; break; case FACTORY_BOOT: print("%s BR FACTORY BOOT\n", MOD); g_boot_mode = FACTORY_BOOT; if(!usb_cable_in()) g_meta_com_type = META_UART_COM; else g_meta_com_type = META_USB_COM; break; case ADVMETA_BOOT: print("%s BR ADVMETA BOOT\n", MOD); g_boot_mode = ADVMETA_BOOT; if(!usb_cable_in()) g_meta_com_type = META_UART_COM; else g_meta_com_type = META_USB_COM; break; case ATE_FACTORY_BOOT: print("%s BR ATE FACTORY BOOT\n", MOD); g_boot_mode = ATE_FACTORY_BOOT; if(!usb_cable_in()) g_meta_com_type = META_UART_COM; else g_meta_com_type = META_USB_COM; break; default: print("%s UNKNOWN MODE\n", MOD); break; } return 0; }
static int bldr_handshake(struct bldr_command_handler *handler) { boot_mode_t mode = 0; /* get mode type */ /* Since entring META mode is from preloader not BROM, we forcely set mode as NORMAL_BOOT */ mode = seclib_brom_meta_mode(); switch (mode) { case NORMAL_BOOT: /* ------------------------- */ /* security check */ /* ------------------------- */ if (TRUE == seclib_sbc_enabled()) { handler->attr |= CMD_HNDL_ATTR_COM_FORBIDDEN; print("%s META DIS\n", MOD); } #if CFG_USB_TOOL_HANDSHAKE if (TRUE == usb_handshake(handler)) g_meta_com_type = META_USB_COM; #endif #if CFG_UART_TOOL_HANDSHAKE if (TRUE == uart_handshake(handler)) g_meta_com_type = META_UART_COM; #endif break; case META_BOOT: print("%s BR META BOOT\n", MOD); g_boot_mode = META_BOOT; /* secure META is only enabled on USB connection */ g_meta_com_type = META_USB_COM; break; case FACTORY_BOOT: print("%s BR FACTORY BOOT\n", MOD); g_boot_mode = FACTORY_BOOT; /* secure META is only enabled on USB connection */ g_meta_com_type = META_USB_COM; break; case ADVMETA_BOOT: print("%s BR ADVMETA BOOT\n", MOD); g_boot_mode = ADVMETA_BOOT; /* secure META is only enabled on USB connection */ g_meta_com_type = META_USB_COM; break; case ATE_FACTORY_BOOT: print("%s BR ATE FACTORY BOOT\n", MOD); g_boot_mode = ATE_FACTORY_BOOT; /* secure META is only enabled on USB connection */ g_meta_com_type = META_USB_COM; break; default: print("%s UNKNOWN MODE\n", MOD); break; } return 0; }