platform.c 30 KB

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