void plat_cpu_reset_late(void) { static uint32_t cntfrq; vaddr_t addr; if (!get_core_pos()) { /* read cnt freq */ cntfrq = read_cntfrq(); #if defined(CFG_BOOT_SECONDARY_REQUEST) /* set secondary entry address */ write32(__compiler_bswap32(CFG_TEE_LOAD_ADDR), DCFG_BASE + DCFG_SCRATCHRW1); /* release secondary cores */ write32(__compiler_bswap32(0x1 << 1), /* cpu1 */ DCFG_BASE + DCFG_CCSR_BRR); dsb(); sev(); #endif /* configure CSU */ /* first grant all peripherals */ for (addr = CSU_BASE + CSU_CSL_START; addr != CSU_BASE + CSU_CSL_END; addr += 4) write32(__compiler_bswap32(CSU_ACCESS_ALL), addr); /* restrict key preipherals from NS */ write32(__compiler_bswap32(CSU_ACCESS_SEC_ONLY), CSU_BASE + CSU_CSL30); write32(__compiler_bswap32(CSU_ACCESS_SEC_ONLY), CSU_BASE + CSU_CSL37); /* lock the settings */ for (addr = CSU_BASE + CSU_CSL_START; addr != CSU_BASE + CSU_CSL_END; addr += 4) write32(read32(addr) | __compiler_bswap32(CSU_SETTING_LOCK), addr); } else { /* program the cntfrq, the cntfrq is banked for each core */ write_cntfrq(cntfrq); } }
static void secondary_init_cntfrq(void) { assert(cntfrq != 0); write_cntfrq(cntfrq); }