/* Calculate the SBL start time for use during boot logger initialization. */ sbl_start_time = CALCULATE_TIMESTAMP(HWIO_IN(TIMETICK_CLK)); boot_clock_debug_init(); /* Enter debug mode if debug cookie is set */ sbl1_debug_mode_enter(); /* Initialize the stack protection canary */ boot_init_stack_chk_canary();
/* Initialize boot shared imem */ boot_shared_imem_init(&bl_shared_data); /*初始化RAM*/ boot_ram_init(&sbl1_ram_init_data); /*初始化log系统,即串口驱动*/ sbl1_boot_logger_init(&boot_log_data, pbl_shared); /*检索PBL传递过来的数据*/ sbl1_retrieve_shared_info_from_pbl(pbl_shared); /* Initialize the QSEE interface */ sbl1_init_sbl_qsee_interface(&bl_shared_data,&sbl_verified_info); /* Initialize SBL memory map. Initializing early because drivers could be located in RPM Code RAM. */ sbl1_populate_initial_mem_map(&bl_shared_data); /*初始化DAL*/ boot_DALSYS_InitMod(NULL); /*配置PMIC芯片,以便我们能通过PS_HOLD复位*/ sbl1_hw_init(); /*执行sbl1的目标依赖进程*/ boot_config_process_bl(&bl_shared_data, SBL1_IMG, sbl1_config_table);
/*---------------------------------------------------------------------- Run deviceprogrammer if compiling the deviceprogrammer_ddr image. ----------------------------------------------------------------------*/ boot_deviceprogrammer_ddr_main,
/* Initialize SBL1 DDR ZI region, relocate boot log to DDR */ sbl1_post_ddr_init,
/* 此函数挺重要,我能改到的东西基本上都基于它,所有的PMIC API都是在此函数调用boot_pm_dirver_init()之后再被调用*/ sbl1_hw_init_secondary, /* DDR training */ (boot_procedure_func_type)sbl1_wait_for_ddr_training,
/* Initialize SBL1 DDR ZI region, relocate page table to DDR */ sbl1_post_ddr_training_init,
/* Zero out QSEE and QHEE region if needed. This MUST be done before boot_dload_dump_security_regions executes for security reasons. */ sbl1_cleanse_security_regions,
/* Backup QSEE and QHEE region for ramdumps taken after SBL has executed */ boot_dload_dump_security_regions,
/* Check to see if DLOAD mode needs to be entered */ boot_dload_check,
/* Enable the secure watchdog This is done after boot_dload_check that way if we are in the final stage of an abnormal reset boot_dload_check will finalize the stage. */ boot_secure_watchdog_init, /* Load SEC partition if it exists. This must be done after QSEE is loaded as the partition is loaded into a QSEE buffer. */ sbl1_load_sec_partition,
/* Set the memory barrier pointer to shared memory */ boot_cache_set_memory_barrier,
/*---------------------------------------------------------------------- Put SMEM in debug state such that smem_alloc() calls will return NULL. The state is changed back to normal once smem_boot_init() is called. This call has to be made after setting the memory barrier. ----------------------------------------------------------------------*/ boot_smem_debug_init, /* Initialize shared memory after dload to preserve logs */ boot_smem_init,
#if !defined(FEATURE_RUMI_BOOT) /* Stub out for rumi build. pmic api pm_get_power_on_status gets called from below api to get power on reason */ /*---------------------------------------------------------------------- Store Power on Status in SMEM. Needs to be done after PMIC and SMEM initialization ----------------------------------------------------------------------*/ boot_smem_store_pon_status, #endif
/*---------------------------------------------------------------------- Store the platform id to smem ----------------------------------------------------------------------*/ sbl1_hw_platform_smem, /*---------------------------------------------------------------------- Get shared data out of the flash device module ----------------------------------------------------------------------*/ boot_share_flash_data, /*---------------------------------------------------------------------- populate the ram partition table ----------------------------------------------------------------------*/ boot_populate_ram_partition_table,
/*---------------------------------------------------------------------- Initialize GPIO for low power configuration ----------------------------------------------------------------------*/ sbl1_tlmm_init, /*----------------------------------------------------------------------- Calls efs cookie handling api to perform efs backup/restore -----------------------------------------------------------------------*/ sbl1_efs_handle_cookies, /*----------------------------------------------------------------------- APT Security Test ----------------------------------------------------------------------*/ (boot_procedure_func_type)boot_apt_test,
//Get handle for charger algorithm specific data (from Dal config) sbl_chg_app_ds = (uint16*)pm_target_information_get_specific_info(PM_PROP_CHG_APP_LUT);
next_state = next_state_ptr->next_chg_state_alg; if (next_state) { err_flag = next_state(); //transition to next state } if ( ( err_flag != PM_ERR_FLAG__SUCCESS ) || ( pm_chg_status.current_state == PM_CHG_BOOTUP_STATE ) || ( pm_chg_status.current_state == PM_CHG_SHUTDOWN_STATE ) //Shutdown state condition will never happen but we have it for sake of being complete ) { break; } } return err_flag; }