boot_init_primary_late()init_external_dt()- Initialize the external DTB located at the given address:
- Add MMU mapping of the external DTB.
- Initialize device tree overlay.
discover_nsec_memory()- Call
get_nsec_memory()to find all non-secure memories from DT. - Lookup for the DT nodes with
device_type = “memory”. - Call
core_mmu_set_discovered_nsec_ddr()to set: discovered_nsec_ddr_startto the first non-secure memory.- Non-secure memories are sorted by the physical address in ascending order.
discovered_nsec_ddr_nelemsto the number of the non-secure memories.update_external_dt()- Call
add_optee_dt_node()to add/firmware/opteeDT node. compatible = "linaro,optee-tz";- Call
mark_tddram_as_reserved()to add/reserved-memory/optee_coreDT node. - Reserve the secure memory regions in DRAM used by OP-TEE (
CFG_TDDRAM_START~(CFG_TDDRAM_START + CFG_TDDRAM_SIZE - 1)) to prevent Linux from using it. - If
CFG_WITH_PAGERis set andCFG_TDSRAM_STARTis defined, TEE core secure RAM (TEE_RAM) is allocated in SRAM, instead of DRAM. We don’t need to reserve the memory region for it. - However, we still need to reserve other secure memory regions in DRAM (TA_RAM) used by OP-TEE.
#ifdef CFG_RISCV_S_MODEmpxy_opteed_channel_init()- Check if MPXY extension is supported by OpenSBI.
- Extract MPXY channel ID from DT:
compatible = “riscv,sbi-mpxy-opteed";riscv,sbi-mpxy-channel-id← Defines MPXY channel ID.- Save MPXY channel ID to
mpxy_opteed_ctx.channel_id. opensbi-domain-instance← Defines the OpenSBI domain used by OP-TEE (not used by OP-TEE).sbi_mpxy_setup_shmem()- Allocates 4KB MPXY shared memory (4KB aligned).
- Call
sbi_mpxy_set_shmemSBI call to set up the allocated MPXY shared memory for the current core. This will invoke OpenSBI’ssbi_mpxy_set_shmem()to save the shared memory address and size into current harttdomain’smpxy_state. boot_primary_init_intc()plic_init()- Initialize interrupt controller, e.g. PLIC.
init_tee_runtime()core_mmu_init_ta_ram()- Initialize the memory region for static TAs.
MEM_AREA_TA_RAM: Secure RAM where teecore loads/exec TA instances.call_preinitcalls()- Call the preinitcalls defined in
.scattered_array_preinitcallsection. - e.g.
mobj_mapped_shm_init()- … etc
call_initcalls()- Call the initcalls defined in
.scattered_array_initcallsection. - e.g.
probe_dt_drivers_early()check_ta_store()early_ta_init()verify_pseudo_tas_conformance()tee_cryp_init()- … etc
call_finalcalls()- Call the finalcalls defined in
scattered_array_call_finalcallsection. - e.g.
release_external_dt()- … etc
#ifdef CFG_RISCV_S_MODEstart_secondary_cores()- Call
sbi_hsm_hart_start()to start the secondary cores. - Start address =
start_addr=_start
boot_init_primary_late()c
Loading...