platform.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2015. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. */
  31. #include <debug.h>
  32. #include <stdlib.h>
  33. #include <string.h>
  34. #include <video.h>
  35. #include <dev/uart.h>
  36. #include <arch/arm.h>
  37. #include <arch/arm/mmu.h>
  38. #include <arch/ops.h>
  39. #include <target/board.h>
  40. #include <platform/mt_reg_base.h>
  41. #include <platform/mt_disp_drv.h>
  42. #include <platform/disp_drv.h>
  43. #include <platform/boot_mode.h>
  44. #include <platform/mt_logo.h>
  45. #include <platform/partition.h>
  46. #include <env.h>
  47. #include <platform/mt_gpio.h>
  48. #include <platform/mt_pmic.h>
  49. #include <platform/mt_pmic_wrap_init.h>
  50. #include <platform/mt_i2c.h>
  51. #include <platform/mtk_key.h>
  52. #include <platform/mt_rtc.h>
  53. #include <platform/mt_leds.h>
  54. #include <platform/upmu_common.h>
  55. #include <platform/mtk_wdt.h>
  56. #include <platform/disp_drv_platform.h>
  57. #include <platform/verified_boot.h>
  58. #include <platform/sec_devinfo.h> // for internal_get_devinfo_with_index()
  59. #include <plinfo.h> // for plinfo_get_brom_header_block_size()
  60. #include <libfdt.h>
  61. #include <mt_gic.h> // for platform_init_interrupts()
  62. #include <mt_boot.h> // for bldr_load_dtb()
  63. #include <platform.h> // for platform_uninit()
  64. #include <mtk_smi.h> // for smi_apply_register_setting()
  65. #include <mtk_dcm.h> // for mt_dcm_init()
  66. #include <plat_debug_interface.h> // for mt_secure_call()
  67. #include <dev/aee_platform_debug.h> // for platform_lastpc_postinit()
  68. #include <profiling.h>
  69. #include <pal_assert.h>
  70. #include <platform/mt_gpt.h> // for get_timer()
  71. #include "mtk_secure_api.h"
  72. #include "memory_layout.h"
  73. #include "load_vfy_boot.h"
  74. #include <rsc.h>
  75. #include <fdt_op.h>
  76. #include <verified_boot_common.h>
  77. #include <fpga_boot_argument.h>
  78. #ifdef MTK_EMMC_SUPPORT
  79. #include "mmc_rpmb.h"
  80. #endif
  81. #define DEVAPC_TURN_ON 1
  82. #ifdef MTK_AB_OTA_UPDATER
  83. #include "bootctrl.h"
  84. #endif
  85. #if defined(MTK_SECURITY_SW_SUPPORT)
  86. #include "oemkey.h"
  87. #endif
  88. #ifdef MTK_UFS_BOOTING
  89. #include "ufs_aio_interface.h"
  90. #endif
  91. #ifdef MTK_CHARGER_NEW_ARCH
  92. #include <mtk_charger.h>
  93. #include <mtk_battery.h>
  94. #endif
  95. #ifdef MTK_SECURITY_SW_SUPPORT
  96. extern u8 g_oemkey[OEM_PUBK_SZ];
  97. #endif
  98. #ifdef LK_DL_CHECK
  99. /*block if check dl fail*/
  100. #undef LK_DL_CHECK_BLOCK_LEVEL
  101. #endif
  102. extern void platform_early_init_timer();
  103. extern void jump_da(u32 addr, u32 arg1, u32 arg2);
  104. extern int i2c_hw_init(void);
  105. extern int mboot_common_load_logo(unsigned long logo_addr, char* filename);
  106. extern int sec_func_init(u64 pl_start_addr);
  107. extern int sec_usbdl_enabled (void);
  108. extern unsigned int crypto_hw_engine_disable(void);
  109. extern void mtk_wdt_disable(void);
  110. extern void platform_deinit_interrupts(void);
  111. extern int mmc_get_dl_info(void);
  112. extern int mmc_legacy_init(int);
  113. extern void platform_clear_cache_retention_select(void);
  114. extern unsigned int crypto_hw_engine_disable(void);
  115. #ifdef MTK_AEE_PLATFORM_DEBUG_SUPPORT
  116. extern void latch_lastbus_init(void);
  117. #endif
  118. #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY
  119. extern kal_bool is_low_battery(kal_int32 val);
  120. extern int hw_charging_get_charger_type(void);
  121. #endif
  122. extern void lk_register_wdt_callback(void);
  123. void config_shared_SRAM_size(void);
  124. extern int dev_info_nr_cpu(void);
  125. extern void mt_pll_turn_off(void);
  126. extern void mt_pll_clk_bootargs(void);
  127. struct mmu_initial_mapping mmu_initial_mappings[] = {
  128. {
  129. .phys = (uint64_t)0,
  130. .virt = (uint32_t)0,
  131. .size = 0x40000000,
  132. .flags = MMU_MEMORY_TYPE_STRONGLY_ORDERED | MMU_MEMORY_AP_P_RW_U_NA,
  133. .name = "mcusys"
  134. },
  135. {
  136. .phys = (uint64_t)MEMBASE,
  137. .virt = (uint32_t)MEMBASE,
  138. .size = ROUNDUP(MEMSIZE, SECTION_SIZE),
  139. .flags = MMU_MEMORY_TYPE_NORMAL_WRITE_BACK | MMU_MEMORY_AP_P_RW_U_NA,
  140. .name = "ram"
  141. },
  142. {
  143. .phys = (uint64_t)SCRATCH_ADDR,
  144. .virt = (uint32_t)SCRATCH_ADDR,
  145. .size = SCRATCH_SIZE,
  146. .flags = MMU_MEMORY_TYPE_NORMAL_WRITE_BACK | MMU_MEMORY_AP_P_RW_U_NA,
  147. .name = "download"
  148. },
  149. /* null entry to terminate the list */
  150. { 0 }
  151. };
  152. BOOT_ARGUMENT *g_boot_arg;
  153. BOOT_ARGUMENT boot_addr;
  154. int g_nr_bank;
  155. BI_DRAM bi_dram[MAX_NR_BANK];
  156. unsigned int g_fb_base;
  157. unsigned int g_fb_size;
  158. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  159. unsigned int g_ext_fb_base;
  160. unsigned int g_ext_fb_size;
  161. #endif
  162. static int g_dram_init_ret;
  163. static unsigned int bootarg_addr;
  164. static unsigned int bootarg_size;
  165. extern unsigned int logo_lk_t;
  166. extern unsigned int boot_time;
  167. int dram_init(void)
  168. {
  169. unsigned int i;
  170. struct boot_tag *tags;
  171. /* Get parameters from pre-loader. Get as early as possible
  172. * The address of BOOT_ARGUMENT_LOCATION will be used by Linux later
  173. * So copy the parameters from BOOT_ARGUMENT_LOCATION to LK's memory region
  174. */
  175. g_boot_arg = &boot_addr;
  176. bootarg_addr = (unsigned int)((unsigned int *)BOOT_ARGUMENT_LOCATION);
  177. bootarg_size = 0;
  178. fpga_set_boot_argument((BOOT_ARGUMENT*)bootarg_addr);
  179. if (*(unsigned int *)BOOT_ARGUMENT_LOCATION == BOOT_ARGUMENT_MAGIC) {
  180. memcpy(g_boot_arg, (void*)BOOT_ARGUMENT_LOCATION, sizeof(BOOT_ARGUMENT));
  181. bootarg_size = sizeof(BOOT_ARGUMENT);
  182. } else {
  183. g_boot_arg->maggic_number = BOOT_ARGUMENT_MAGIC;
  184. for (tags = (void *)BOOT_ARGUMENT_LOCATION; tags->hdr.size; tags = boot_tag_next(tags)) {
  185. switch (tags->hdr.tag) {
  186. case BOOT_TAG_BOOT_REASON:
  187. g_boot_arg->boot_reason = tags->u.boot_reason.boot_reason;
  188. break;
  189. case BOOT_TAG_BOOT_MODE:
  190. g_boot_arg->boot_mode = tags->u.boot_mode.boot_mode;
  191. break;
  192. case BOOT_TAG_META_COM:
  193. g_boot_arg->meta_com_type = tags->u.meta_com.meta_com_type;
  194. g_boot_arg->meta_com_id = tags->u.meta_com.meta_com_id;
  195. g_boot_arg->meta_uart_port = tags->u.meta_com.meta_uart_port;
  196. g_boot_arg->meta_log_disable = tags->u.meta_com.meta_log_disable;
  197. g_boot_arg->fast_meta_gpio = tags->u.meta_com.fast_meta_gpio;
  198. break;
  199. case BOOT_TAG_LOG_COM:
  200. g_boot_arg->log_port = tags->u.log_com.log_port;
  201. g_boot_arg->log_baudrate = tags->u.log_com.log_baudrate;
  202. g_boot_arg->log_enable = tags->u.log_com.log_enable;
  203. g_boot_arg->log_dynamic_switch = tags->u.log_com.log_dynamic_switch;
  204. break;
  205. case BOOT_TAG_MEM:
  206. g_boot_arg->dram_rank_num = tags->u.mem.dram_rank_num;
  207. for (i = 0; i < tags->u.mem.dram_rank_num; i++) {
  208. g_boot_arg->dram_rank_size[i] = tags->u.mem.dram_rank_size[i];
  209. }
  210. g_boot_arg->mblock_info = tags->u.mem.mblock_info;
  211. g_boot_arg->orig_dram_info = tags->u.mem.orig_dram_info;
  212. g_boot_arg->lca_reserved_mem = tags->u.mem.lca_reserved_mem;
  213. g_boot_arg->tee_reserved_mem = tags->u.mem.tee_reserved_mem;
  214. break;
  215. case BOOT_TAG_MD_INFO:
  216. for (i = 0; i < 4; i++) {
  217. g_boot_arg->md_type[i] = tags->u.md_info.md_type[i];
  218. }
  219. break;
  220. case BOOT_TAG_BOOT_TIME:
  221. g_boot_arg->boot_time = tags->u.boot_time.boot_time;
  222. break;
  223. case BOOT_TAG_DA_INFO:
  224. memcpy(&g_boot_arg->da_info, &tags->u.da_info.da_info, sizeof(da_info_t));
  225. break;
  226. case BOOT_TAG_SEC_INFO:
  227. memcpy(&g_boot_arg->sec_limit, &tags->u.sec_info.sec_limit, sizeof(SEC_LIMIT));
  228. break;
  229. case BOOT_TAG_PART_NUM:
  230. g_boot_arg->part_num = tags->u.part_num.part_num;
  231. break;
  232. case BOOT_TAG_PART_INFO:
  233. g_boot_arg->part_info = tags->u.part_info.part_info; /* only copy the pointer but the contains*/
  234. break;
  235. case BOOT_TAG_EFLAG:
  236. g_boot_arg->e_flag = tags->u.eflag.e_flag;
  237. break;
  238. case BOOT_TAG_DDR_RESERVE:
  239. g_boot_arg->ddr_reserve_enable = tags->u.ddr_reserve.ddr_reserve_enable;
  240. g_boot_arg->ddr_reserve_success = tags->u.ddr_reserve.ddr_reserve_success;
  241. g_boot_arg->ddr_reserve_ready = tags->u.ddr_reserve.ddr_reserve_ready;
  242. break;
  243. case BOOT_TAG_DRAM_BUF:
  244. g_boot_arg->dram_buf_size = tags->u.dram_buf.dram_buf_size;
  245. break;
  246. case BOOT_TAG_SRAM_INFO:
  247. g_boot_arg->non_secure_sram_addr = tags->u.sram_info.non_secure_sram_addr;
  248. g_boot_arg->non_secure_sram_size = tags->u.sram_info.non_secure_sram_size;
  249. break;
  250. case BOOT_TAG_PLAT_DBG_INFO:
  251. g_boot_arg->plat_dbg_info_max = tags->u.plat_dbg_info.info_max;
  252. for (i = 0; (i < INFO_TYPE_MAX) && (i < g_boot_arg->plat_dbg_info_max); i++) {
  253. g_boot_arg->plat_dbg_info[i].key = tags->u.plat_dbg_info.info[i].key;
  254. g_boot_arg->plat_dbg_info[i].base = tags->u.plat_dbg_info.info[i].base;
  255. g_boot_arg->plat_dbg_info[i].size = tags->u.plat_dbg_info.info[i].size;
  256. }
  257. break;
  258. case BOOT_TAG_PTP:
  259. memcpy(&g_boot_arg->ptp_volt_info, &tags->u.ptp_volt.ptp_volt_info, sizeof(ptp_info_t));
  260. break;
  261. case BOOT_TAG_EMI_INFO:
  262. memcpy(&(g_boot_arg->emi_info), &(tags->u.emi_info), sizeof(emi_info_t));
  263. break;
  264. case BOOT_TAG_IMGVER_INFO:
  265. g_boot_arg->pl_imgver_status = tags->u.imgver_info.pl_imgver_status;
  266. break;
  267. case BOOT_TAG_MAX_CPUS:
  268. g_boot_arg->max_cpus = tags->u.max_cpus.max_cpus;
  269. break;
  270. case BOOT_TAG_CHR_INFO:
  271. g_boot_arg->charger_type = tags->u.chr_info.charger_type;
  272. break;
  273. case BOOT_TAG_RAM_CONSOLE_INFO:
  274. g_boot_arg->ram_console_sram_addr = tags->u.ram_console_info.sram_addr;
  275. g_boot_arg->ram_console_sram_size = tags->u.ram_console_info.sram_size;
  276. g_boot_arg->ram_console_def_type = tags->u.ram_console_info.def_type;
  277. g_boot_arg->ram_console_memory_info_offset = tags->u.ram_console_info.memory_info_offset;
  278. break;
  279. case BOOT_TAG_SOC_ID:
  280. memcpy(g_boot_arg->socid, tags->u.socid.id, SOC_ID_LEN);
  281. break;
  282. default:
  283. break;
  284. }
  285. bootarg_size += tags->hdr.size;
  286. }
  287. }
  288. fpga_copy_boot_argument(g_boot_arg);
  289. g_nr_bank = g_boot_arg->dram_rank_num;
  290. if (g_nr_bank == 0 || g_nr_bank > MAX_NR_BANK) {
  291. g_dram_init_ret = -1;
  292. //dprintf(CRITICAL, "[LK ERROR] DRAM bank number is not correct!!!");
  293. //while (1) ;
  294. return -1;
  295. }
  296. #ifndef CUSTOM_CONFIG_MAX_DRAM_SIZE
  297. /* return the actual DRAM info */
  298. for (i = 0; i < (unsigned int)(g_boot_arg->mblock_info.mblock_num); i++) {
  299. bi_dram[i].start = g_boot_arg->mblock_info.mblock[i].start;
  300. bi_dram[i].size = g_boot_arg->mblock_info.mblock[i].size;
  301. }
  302. //#elif (CUSTOM_CONFIG_MAX_DRAM_SIZE < 0x10000000)
  303. //#error "DRAM size < 0x10000000" /* DRAM is less than 256MB, trigger build error */
  304. #else
  305. #endif
  306. return 0;
  307. }
  308. unsigned int platform_get_bootarg_addr(void)
  309. {
  310. return bootarg_addr;
  311. }
  312. unsigned int platform_get_bootarg_size(void)
  313. {
  314. return bootarg_size;
  315. }
  316. /*******************************************************
  317. * Routine: memory_size
  318. * Description: return DRAM size to LCM driver
  319. ******************************************************/
  320. u32 ddr_enable_4gb(void)
  321. {
  322. u32 status;
  323. #define INFRA_MISC (INFRACFG_AO_BASE + 0x0F00)
  324. #define INFRA_4GB_EN (1 << 13)
  325. #define PERI_MISC (PERICFG_BASE + 0x0208)
  326. #define PERI_4GB_EN (1 << 15)
  327. status = ((DRV_Reg32(INFRA_MISC) & INFRA_4GB_EN) && (DRV_Reg32(PERI_MISC) & PERI_4GB_EN)) ? 1 : 0;
  328. dprintf(CRITICAL, "%s() status=%u\n", __func__, status);
  329. return status;
  330. }
  331. u64 physical_memory_size(void)
  332. {
  333. int i;
  334. unsigned long long size = 0;
  335. for (i = 0; i < (int)(g_boot_arg->orig_dram_info.rank_num); i++) {
  336. size += g_boot_arg->orig_dram_info.rank_info[i].size;
  337. }
  338. return size;
  339. }
  340. u32 memory_size(void)
  341. {
  342. unsigned long long size = physical_memory_size();
  343. while (((unsigned long long)DRAM_PHY_ADDR + size) > 0x100000000ULL) {
  344. size -= (unsigned long long)(1024*1024*1024);
  345. }
  346. return (unsigned int)size;
  347. }
  348. void sw_env()
  349. {
  350. #ifdef LK_DL_CHECK
  351. #if defined(MTK_EMMC_SUPPORT) || defined(MTK_UFS_BOOTING)
  352. int dl_status = 0;
  353. dl_status = mmc_get_dl_info();
  354. dprintf(INFO, "mt65xx_sw_env--dl_status: %d\n", dl_status);
  355. if (dl_status != 0) {
  356. video_printf("=> TOOL DL image Fail!\n");
  357. dprintf(CRITICAL, "TOOL DL image Fail\n");
  358. #ifdef LK_DL_CHECK_BLOCK_LEVEL
  359. dprintf(CRITICAL, "uboot is blocking by dl info\n");
  360. while (1) ;
  361. #endif
  362. }
  363. #endif
  364. #endif
  365. #ifndef MACH_FPGA_NO_DISPLAY
  366. #ifndef USER_BUILD
  367. switch (g_boot_mode) {
  368. case META_BOOT:
  369. video_printf(" => META MODE\n");
  370. break;
  371. case FACTORY_BOOT:
  372. video_printf(" => FACTORY MODE\n");
  373. break;
  374. case RECOVERY_BOOT:
  375. video_printf(" => RECOVERY MODE\n");
  376. break;
  377. case SW_REBOOT:
  378. //video_printf(" => SW RESET\n");
  379. break;
  380. case NORMAL_BOOT:
  381. //if(g_boot_arg->boot_reason != BR_RTC && get_env("hibboot") != NULL && atoi(get_env("hibboot")) == 1)
  382. if (get_env("hibboot") != NULL && atoi(get_env("hibboot")) == 1)
  383. video_printf(" => HIBERNATION BOOT\n");
  384. else
  385. video_printf(" => NORMAL BOOT\n");
  386. break;
  387. case ADVMETA_BOOT:
  388. video_printf(" => ADVANCED META MODE\n");
  389. break;
  390. case ATE_FACTORY_BOOT:
  391. video_printf(" => ATE FACTORY MODE\n");
  392. break;
  393. #ifdef MTK_KERNEL_POWER_OFF_CHARGING
  394. case KERNEL_POWER_OFF_CHARGING_BOOT:
  395. video_printf(" => POWER OFF CHARGING MODE\n");
  396. break;
  397. case LOW_POWER_OFF_CHARGING_BOOT:
  398. video_printf(" => LOW POWER OFF CHARGING MODE\n");
  399. break;
  400. #endif
  401. case ALARM_BOOT:
  402. video_printf(" => ALARM BOOT\n");
  403. break;
  404. case FASTBOOT:
  405. video_printf(" => FASTBOOT mode...\n");
  406. break;
  407. default:
  408. video_printf(" => UNKNOWN BOOT\n");
  409. }
  410. return;
  411. #endif
  412. #ifdef USER_BUILD
  413. /* it's ok to display META MODE since it already verfied by preloader */
  414. if (g_boot_mode == META_BOOT)
  415. video_printf(" => META MODE\n");
  416. if (g_boot_mode == FASTBOOT)
  417. video_printf(" => FASTBOOT mode...\n");
  418. return;
  419. #endif
  420. #endif
  421. }
  422. extern uint64_t ld_tt_l1[4];
  423. void platform_init_mmu(void)
  424. {
  425. /* configure available RAM banks */
  426. dram_init();
  427. /* Long-descriptor translation with lpae enable */
  428. arm_mmu_lpae_init();
  429. struct mmu_initial_mapping *m = mmu_initial_mappings;
  430. for (uint i = 0; i < countof(mmu_initial_mappings); i++, m++) {
  431. arch_mmu_map(m->phys, m->virt, m->flags, m->size);
  432. }
  433. arch_enable_mmu(); //enable mmu after setup page table to avoid cpu prefetch which may bring on emi violation
  434. }
  435. /******************************************************************************
  436. ******************************************************************************/
  437. void init_storage(void)
  438. {
  439. PROFILING_START("NAND/EMMC init");
  440. #if defined(MTK_EMMC_SUPPORT)
  441. mmc_legacy_init(1);
  442. #elif defined(MTK_UFS_BOOTING)
  443. ufs_lk_init();
  444. #else
  445. #ifndef MACH_FPGA
  446. nand_init();
  447. nand_driver_test();
  448. #endif // MACH_FPGA
  449. #endif // MTK_EMMC_SUPPORT
  450. #if defined(MTK_EMMC_SUPPORT) || defined(MTK_UFS_BOOTING)
  451. init_rpmb_sharemem();
  452. #endif
  453. PROFILING_END(); /* NAND/EMMC init */
  454. }
  455. /******************************************************************************
  456. ******************************************************************************/
  457. void platform_early_init(void)
  458. {
  459. PROFILING_START("platform_early_init");
  460. lk_register_wdt_callback();
  461. /* initialize the uart */
  462. uart_init_early();
  463. PROFILING_START("Devinfo Init");
  464. init_devinfo_data();
  465. PROFILING_END();
  466. platform_init_interrupts();
  467. platform_early_init_timer();
  468. #if !defined(USE_DTB_NO_DWS) && !defined(MACH_FPGA)
  469. mt_gpio_set_default();
  470. #endif // !defined(USE_DTB_NO_DWS) && !defined(MACH_FPGA)
  471. dprintf(SPEW, "bootarg_addr: 0x%x, bootarg_size: 0x%x\n", platform_get_bootarg_addr(), platform_get_bootarg_size());
  472. if (g_dram_init_ret < 0) {
  473. dprintf(CRITICAL, "[LK ERROR] DRAM bank number is not correct!!!\n");
  474. while (1) ;
  475. }
  476. //i2c_v1_init();
  477. PROFILING_START("WDT Init");
  478. mtk_wdt_init();
  479. PROFILING_END();
  480. //i2c init
  481. i2c_hw_init();
  482. #ifdef MACH_FPGA
  483. mtk_timer_init(); // GPT4 will be initialized at PL after
  484. mtk_wdt_disable(); // WDT will be triggered when uncompressing linux image on FPGA
  485. #endif
  486. pwrap_init_lk();
  487. #if !defined(MACH_FPGA) && !defined(NO_PMIC)
  488. PROFILING_START("pmic_init");
  489. pmic_init();
  490. PROFILING_END();
  491. #endif // !defined(MACH_FPGA) && !defined(NO_PMIC)
  492. PROFILING_END(); /* platform_early_init */
  493. }
  494. extern void mt65xx_bat_init(void);
  495. extern bool mtk_bat_allow_backlight_enable(void);
  496. #if defined (MTK_KERNEL_POWER_OFF_CHARGING)
  497. int kernel_charging_boot(void)
  498. {
  499. if ((g_boot_mode == KERNEL_POWER_OFF_CHARGING_BOOT || g_boot_mode == LOW_POWER_OFF_CHARGING_BOOT) && upmu_is_chr_det() == KAL_TRUE) {
  500. dprintf(INFO,"[%s] Kernel Power Off Charging with Charger/Usb \n", __func__);
  501. return 1;
  502. } else if ((g_boot_mode == KERNEL_POWER_OFF_CHARGING_BOOT || g_boot_mode == LOW_POWER_OFF_CHARGING_BOOT) && upmu_is_chr_det() == KAL_FALSE) {
  503. dprintf(INFO,"[%s] Kernel Power Off Charging without Charger/Usb \n", __func__);
  504. return -1;
  505. } else
  506. return 0;
  507. }
  508. #endif
  509. static void lk_vb_init(void)
  510. {
  511. #ifdef MTK_SECURITY_SW_SUPPORT
  512. u64 pl_start_addr = 0;
  513. PROFILING_START("lk_vb_init");
  514. #ifdef MTK_VER_SIMPLE_TEST
  515. u32 ret = 0;
  516. ret = sec_mtk_internal_ver_test(MTK_VER_SIMPLE_TEST);
  517. if (ret)
  518. assert(0);
  519. #endif
  520. #ifdef MTK_OTP_FRAMEWORK_V2
  521. enable_anti_rollback_v2_framework();
  522. #endif
  523. /* get preloader start address */
  524. plinfo_get_brom_header_block_size(&pl_start_addr);
  525. /* initialize security library */
  526. sec_func_init(pl_start_addr);
  527. seclib_set_oemkey(g_oemkey, OEM_PUBK_SZ);
  528. PROFILING_END();
  529. #endif
  530. }
  531. static void lk_vb_vfy_logo(void)
  532. {
  533. #ifdef MTK_SECURITY_SW_SUPPORT
  534. /* bypass logo vfy in fast meta mode */
  535. if(g_boot_mode == META_BOOT)
  536. return;
  537. PROFILING_START("logo verify");
  538. /* Verify logo before use it */
  539. if ( 0 != img_auth_stor("logo", "logo", 0x0) ) {
  540. dprintf(CRITICAL,"<ASSERT> %s:line %d\n",__FILE__,__LINE__);
  541. PAL_ASSERT(0);
  542. }
  543. PROFILING_END();
  544. #endif
  545. }
  546. void platform_init(void)
  547. {
  548. bool bearly_backlight_on = false;
  549. int logo_size;
  550. PROFILING_START("platform_init");
  551. dprintf(CRITICAL, "platform_init()\n");
  552. init_storage();
  553. lk_vb_init();
  554. extern void dummy_ap_entry(void)__attribute__((weak)); /* This is empty function for normal load */
  555. if (dummy_ap_entry)
  556. dummy_ap_entry();
  557. #ifdef MTK_AB_OTA_UPDATER
  558. /* get A/B system parameter before load dtb from boot image */
  559. get_AB_OTA_param();
  560. #endif
  561. /*
  562. * RSC initialize. It must be done before load device tree.
  563. * rsc_init will ectract DTBO index, which will be used in device
  564. * tree overlay, from PARA partition
  565. */
  566. rsc_init();
  567. /* The device tree should be loaded as early as possible. */
  568. load_device_tree();
  569. #if defined(USE_DTB_NO_DWS) && !defined(MACH_FPGA)
  570. mt_gpio_set_default();
  571. #endif // defined(USE_DTB_NO_DWS) && !defined(MACH_FPGA)
  572. #ifndef MACH_FPGA
  573. PROFILING_START("led init");
  574. leds_init();
  575. PROFILING_END();
  576. #endif // MACH_FPGA
  577. #ifdef MTK_KERNEL_POWER_OFF_CHARGING
  578. if ((g_boot_arg->boot_reason == BR_USB) && (upmu_is_chr_det() == KAL_FALSE)) {
  579. dprintf(INFO, "[%s] Unplugged Charger/Usb between Pre-loader and Uboot in Kernel Charging Mode, Power Off \n", __func__);
  580. mt_power_off();
  581. }
  582. #endif // MTK_KERNEL_POWER_OFF_CHARGING
  583. PROFILING_START("ENV init");
  584. env_init();
  585. print_env();
  586. PROFILING_END();
  587. PROFILING_START("disp init");
  588. #if defined(MTK_SMI_SUPPORT) && !defined(MACH_FPGA)
  589. /* write SMI non on-the-fly register before DISP init */
  590. smi_apply_register_setting();
  591. #endif
  592. /* initialize the frame buffet information */
  593. g_fb_size = mt_disp_get_vram_size();
  594. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  595. g_ext_fb_size = mt_disp_get_ext_vram_size();
  596. #endif
  597. g_fb_base = mblock_reserve_ext(&g_boot_arg->mblock_info, g_fb_size, 0x10000, 0x80000000, 0, "framebuffer");
  598. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  599. g_ext_fb_base = mblock_reserve_ext(&g_boot_arg->mblock_info, g_ext_fb_size, 0x10000, 0x80000000, 0, "framebuffer_ext");
  600. if (!g_fb_base) {
  601. dprintf(CRITICAL, "reserve framebuffer failed\n");
  602. }
  603. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  604. if (!g_ext_fb_base) {
  605. dprintf(CRITICAL, "reserve framebuffer_ext failed\n");
  606. }
  607. #endif
  608. #endif
  609. dprintf(CRITICAL, "FB base = 0x%x, FB size = 0x%x (%d)\n", g_fb_base, g_fb_size, g_fb_size);
  610. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  611. dprintf(CRITICAL, "EXT_FB base = 0x%x, EXT_FB size = 0x%x (%d)\n", g_ext_fb_base, g_ext_fb_size, g_ext_fb_size);
  612. #endif
  613. #ifndef MACH_FPGA_NO_DISPLAY
  614. mt_disp_init((void *)g_fb_base);
  615. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  616. mt_ext_disp_init((void *)g_ext_fb_base);
  617. #endif
  618. drv_video_init();
  619. #endif
  620. PROFILING_END();
  621. /*for kpd pmic mode setting*/
  622. set_kpd_pmic_mode();
  623. #ifndef MACH_FPGA
  624. PROFILING_START("boot mode select");
  625. #if !defined(NO_BOOT_MODE_SEL)
  626. boot_mode_select();
  627. #endif
  628. #ifdef MTK_USB2JTAG_SUPPORT
  629. if (g_boot_mode != FASTBOOT) {
  630. extern void usb2jtag_init(void);
  631. usb2jtag_init();
  632. }
  633. #endif
  634. #ifdef MTK_AEE_PLATFORM_DEBUG_SUPPORT
  635. /* init lastbus: MUST call after kedump (in boot_mode_select) */
  636. latch_lastbus_init();
  637. #endif
  638. PROFILING_END(); /* boot mode select */
  639. #endif /*MACH_FPGA */
  640. #ifndef MACH_FPGA_NO_DISPLAY
  641. /* fast meta mode */
  642. if(g_boot_mode != META_BOOT){
  643. PROFILING_START("load_logo");
  644. logo_size = mboot_common_load_logo((unsigned long)mt_get_logo_db_addr_pa(), "logo");
  645. assert(logo_size <= LK_LOGO_MAX_SIZE);
  646. PROFILING_END();
  647. } else {
  648. /* Indicate logo lib that logo partition is not loaded */
  649. enable_logo(0);
  650. }
  651. #endif // MACH_FPGA_NO_DISPLAY
  652. lk_vb_vfy_logo();
  653. /*Show download logo & message on screen */
  654. if (g_boot_arg->boot_mode == DOWNLOAD_BOOT) {
  655. dprintf(CRITICAL, "[LK] boot mode is DOWNLOAD_BOOT\n");
  656. #ifndef MACH_FPGA_NO_DISPLAY
  657. PROFILING_START("show logo");
  658. mt_disp_show_boot_logo();
  659. PROFILING_END();
  660. #endif
  661. video_printf(" => Downloading...\n");
  662. dprintf(CRITICAL, "enable backlight after show bootlogo! \n");
  663. #ifndef MACH_FPGA
  664. PROFILING_START("backlight");
  665. mt65xx_backlight_on();
  666. PROFILING_END();
  667. #endif
  668. #ifndef MACH_FPGA_NO_DISPLAY
  669. /* pwm need display sof */
  670. PROFILING_START("disp update");
  671. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  672. PROFILING_END();
  673. #endif
  674. logo_lk_t = ((unsigned int)get_timer(boot_time));
  675. PROFILING_START("disable wdt, l2, cache, mmu");
  676. mtk_wdt_disable(); //Disable wdt before jump to DA
  677. platform_uninit();
  678. #ifdef HAVE_CACHE_PL310
  679. l2_disable();
  680. #endif
  681. arch_disable_cache(UCACHE);
  682. arch_disable_mmu();
  683. #ifdef ENABLE_L2_SHARING
  684. config_shared_SRAM_size();
  685. #endif
  686. PROFILING_END();
  687. jump_da(g_boot_arg->da_info.addr, g_boot_arg->da_info.arg1, g_boot_arg->da_info.arg2);
  688. }
  689. #ifdef MTK_KERNEL_POWER_OFF_CHARGING
  690. else if (g_boot_mode != ALARM_BOOT && g_boot_mode != FASTBOOT && g_boot_mode != KERNEL_POWER_OFF_CHARGING_BOOT && g_boot_mode != LOW_POWER_OFF_CHARGING_BOOT && mtk_bat_allow_backlight_enable()) {
  691. #ifndef MACH_FPGA_NO_DISPLAY
  692. /* fast meta mode */
  693. if(g_boot_mode != META_BOOT){
  694. PROFILING_START("show logo");
  695. mt_disp_show_boot_logo();
  696. PROFILING_END();
  697. }
  698. #endif // MACH_FPGA_NO_DISPLAY
  699. #ifndef MACH_FPGA
  700. PROFILING_START("backlight");
  701. mt65xx_backlight_on();
  702. PROFILING_END(); /* backlight */
  703. #endif // MACH_FPGA
  704. #ifndef MACH_FPGA_NO_DISPLAY
  705. /* fast meta mode */
  706. if(g_boot_mode != META_BOOT){
  707. PROFILING_START("disp update");
  708. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  709. PROFILING_END();
  710. }
  711. #endif // MACH_FPGA_NO_DISPLAY
  712. bearly_backlight_on = true;
  713. dprintf(INFO, "backlight enabled before battery init\n");
  714. logo_lk_t = ((unsigned int)get_timer(boot_time));
  715. }
  716. #endif // MTK_KERNEL_POWER_OFF_CHARGING
  717. PROFILING_START("battery init");
  718. #ifndef MACH_FPGA
  719. mt_pll_clk_bootargs();
  720. #if !defined(NO_PLL_TURN_OFF)
  721. mt_pll_turn_off();
  722. #endif // !defined(NO_PLL_TURN_OFF)
  723. #if !defined(NO_DCM)
  724. if (mt_dcm_init())
  725. dprintf(CRITICAL, "mt_dcm_init fail\n");
  726. #endif // !defined(NO_DCM)
  727. #if !defined(NO_BAT_INIT)
  728. #ifdef MTK_CHARGER_NEW_ARCH
  729. mtk_charger_init();
  730. pmic_dlpt_init();
  731. check_sw_ocv();
  732. mtk_charger_start();
  733. get_dlpt_imix_r();
  734. #else
  735. mt65xx_bat_init();
  736. #endif // MTK_CHARGER_NEW_ARCH
  737. #endif // !defined(NO_BAT_INIT)
  738. #endif // MACH_FPGA
  739. PROFILING_END(); /* battery init */
  740. #ifndef CFG_POWER_CHARGING
  741. PROFILING_START("RTC boot check Init");
  742. /* NOTE: if define CFG_POWER_CHARGING, will rtc_boot_check() in mt65xx_bat_init() */
  743. rtc_boot_check(false);
  744. PROFILING_END();
  745. #endif // CFG_POWER_CHARGING
  746. #ifdef MTK_KERNEL_POWER_OFF_CHARGING
  747. if (kernel_charging_boot() == 1) {
  748. PROFILING_START("show logo");
  749. #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY
  750. CHARGER_TYPE CHR_Type_num = CHARGER_UNKNOWN;
  751. CHR_Type_num = hw_charging_get_charger_type();
  752. if ((g_boot_mode != LOW_POWER_OFF_CHARGING_BOOT) ||
  753. ((CHR_Type_num != STANDARD_HOST) && (CHR_Type_num != NONSTANDARD_CHARGER))) {
  754. #endif // MTK_BATLOWV_NO_PANEL_ON_EARLY
  755. mt_disp_power(TRUE);
  756. #ifndef MACH_FPGA_NO_DISPLAY
  757. mt_disp_show_low_battery();
  758. #endif
  759. mt65xx_leds_brightness_set(6, 110);
  760. #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY
  761. }
  762. #endif
  763. PROFILING_END();
  764. } else if (g_boot_mode != KERNEL_POWER_OFF_CHARGING_BOOT && g_boot_mode != LOW_POWER_OFF_CHARGING_BOOT) {
  765. /* fast meta mode */
  766. if(g_boot_mode != META_BOOT)
  767. if (g_boot_mode != ALARM_BOOT && (g_boot_mode != FASTBOOT) && !bearly_backlight_on) {
  768. #ifndef MACH_FPGA_NO_DISPLAY
  769. PROFILING_START("show logo");
  770. mt_disp_show_boot_logo();
  771. PROFILING_END();
  772. #endif
  773. }
  774. }
  775. #else // MTK_KERNEL_POWER_OFF_CHARGING
  776. /* fast meta mode */
  777. if(g_boot_mode != META_BOOT)
  778. if (g_boot_mode != ALARM_BOOT && (g_boot_mode != FASTBOOT) && !bearly_backlight_on) {
  779. #ifndef MACH_FPGA_NO_DISPLAY
  780. PROFILING_START("show logo");
  781. mt_disp_show_boot_logo();
  782. PROFILING_END(); /* show logo */
  783. #endif
  784. }
  785. #endif // MTK_KERNEL_POWER_OFF_CHARGING
  786. #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY
  787. if (!is_low_battery(0)) {
  788. #endif
  789. #ifndef MACH_FPGA
  790. PROFILING_START("backlight");
  791. mt65xx_backlight_on();
  792. PROFILING_END(); /* backlight */
  793. #endif
  794. //pwm need display sof
  795. #ifndef MACH_FPGA_NO_DISPLAY
  796. PROFILING_START("display update");
  797. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  798. PROFILING_END();
  799. if (!bearly_backlight_on)
  800. logo_lk_t = ((unsigned int)get_timer(boot_time));
  801. #endif
  802. #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY
  803. }
  804. #endif
  805. #ifndef MACH_FPGA
  806. PROFILING_START("sw_env");
  807. sw_env();
  808. PROFILING_END();
  809. #endif
  810. PROFILING_END(); /* platform_init */
  811. }
  812. void platform_uninit(void)
  813. {
  814. #if 0
  815. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  816. /* mt_ext_disp_deinit();*/
  817. #endif
  818. leds_deinit();
  819. platform_lastpc_postinit();
  820. #endif
  821. platform_deinit_interrupts();
  822. return;
  823. }
  824. #ifdef ENABLE_L2_SHARING
  825. #define ADDR_CA7L_CACHE_CONFIG_MP(x) (CA7MCUCFG_BASE + 0x200 * x)
  826. #define L2C_SIZE_CFG_OFFSET 8
  827. #define L2C_SHARE_EN_OFFSET 12
  828. /* 4'b1111: 2048KB(not support)
  829. * 4'b0111: 1024KB(not support)
  830. * 4'b0011: 512KB
  831. * 4'b0001: 256KB
  832. * 4'b0000: 128KB (not support)
  833. */
  834. int is_l2_need_config(void)
  835. {
  836. volatile unsigned int cache_cfg, addr;
  837. addr = ADDR_CA7L_CACHE_CONFIG_MP(0);
  838. cache_cfg = DRV_Reg32(addr);
  839. cache_cfg = cache_cfg >> L2C_SIZE_CFG_OFFSET;
  840. /* only read 256KB need to be config.*/
  841. if ((cache_cfg &(0x7)) == 0x1) {
  842. return 1;
  843. }
  844. return 0;
  845. }
  846. void cluster_l2_share_enable(int cluster)
  847. {
  848. volatile unsigned int cache_cfg, addr;
  849. addr = ADDR_CA7L_CACHE_CONFIG_MP(cluster);
  850. /* set L2C size to 256KB */
  851. cache_cfg = DRV_Reg32(addr);
  852. cache_cfg &= (~0x7) << L2C_SIZE_CFG_OFFSET;
  853. cache_cfg |= 0x1 << L2C_SIZE_CFG_OFFSET;
  854. /* enable L2C_share_en. Sram only for other to use*/
  855. cache_cfg |= (0x1 << L2C_SHARE_EN_OFFSET);
  856. DRV_WriteReg32(addr, cache_cfg);
  857. }
  858. void cluster_l2_share_disable(int cluster)
  859. {
  860. volatile unsigned int cache_cfg, addr;
  861. addr = ADDR_CA7L_CACHE_CONFIG_MP(cluster);
  862. /* set L2C size to 512KB */
  863. cache_cfg = DRV_Reg32(addr);
  864. cache_cfg &= (~0x7) << L2C_SIZE_CFG_OFFSET;
  865. cache_cfg |= 0x3 << L2C_SIZE_CFG_OFFSET;
  866. DRV_WriteReg32(addr, cache_cfg);
  867. /* disable L2C_share_en. Sram only for cpu to use*/
  868. cache_cfg &= ~(0x1 << L2C_SHARE_EN_OFFSET);
  869. DRV_WriteReg32(addr, cache_cfg);
  870. }
  871. /* config L2 cache and sram to its size */
  872. void config_L2_size(void)
  873. {
  874. int cluster;
  875. if (is_l2_need_config()) {
  876. /*
  877. * Becuase mcu config is protected.
  878. * only can write in secutity mode
  879. */
  880. if (dev_info_nr_cpu() == 6) {
  881. cluster_l2_share_disable(0);
  882. cluster_l2_share_enable(1);
  883. }
  884. else {
  885. for (cluster = 0; cluster < 2; cluster++) {
  886. cluster_l2_share_disable(cluster);
  887. }
  888. }
  889. }
  890. }
  891. /* config SRAM back from L2 cache for DA relocation */
  892. void config_shared_SRAM_size(void)
  893. {
  894. int cluster;
  895. if (is_l2_need_config()) {
  896. /*
  897. * Becuase mcu config is protected.
  898. * only can write in secutity mode
  899. */
  900. for (cluster = 0; cluster < 2; cluster++) {
  901. cluster_l2_share_enable(cluster);
  902. }
  903. }
  904. }
  905. #endif
  906. void platform_sec_post_init(void)
  907. {
  908. unsigned int ret = 0;
  909. /* Lock Device APC in LK */
  910. dprintf(CRITICAL, "[DEVAPC] sec_post_init\n");
  911. ret = crypto_hw_engine_disable();
  912. if (ret) {
  913. dprintf(CRITICAL, "[SEC] crypto engine HW disable fail\n");
  914. }
  915. #if DEVAPC_TURN_ON
  916. dprintf(CRITICAL, "[DEVAPC] platform_sec_post_init - SMC call to ATF from LK\n");
  917. mt_secure_call(MTK_SIP_LK_DAPC_INIT, 0, 0, 0, 0);
  918. #endif
  919. }
  920. u32 get_devinfo_with_index(u32 index)
  921. {
  922. return internal_get_devinfo_with_index(index);
  923. }
  924. int platform_skip_hibernation(void)
  925. {
  926. switch (g_boot_arg->boot_reason) {
  927. #if 0 // let schedule power on to go hiberantion bootup process
  928. case BR_RTC:
  929. #endif
  930. case BR_WDT:
  931. case BR_WDT_BY_PASS_PWK:
  932. case BR_WDT_SW:
  933. case BR_WDT_HW:
  934. return 1;
  935. }
  936. return 0;
  937. }
  938. int is_meta_log_disable(void)
  939. {
  940. return g_boot_arg->meta_log_disable;
  941. }