platform.c 30 KB

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