/* * int bcm_kona_do_smc(u32 service_id, u32 buffer_addr) * * Only core 0 can run the secure monitor code. If an "smc" request * is initiated on a different core it must be redirected to core 0 * for execution. We rely on the caller to handle this. * * Each "smc" request supplies a service id and the address of a * buffer containing parameters related to the service to be * performed. A flags value defines the behavior of the level 2 * cache and interrupt handling while the secure monitor executes. * * Parameters to the "smc" request are passed in r4-r6 as follows: * r4 service id * r5 flags (SEC_ROM_*) * r6 physical address of buffer with other parameters * * Execution of an "smc" request produces two distinct results. * * First, the secure monitor call itself (regardless of the specific * service request) can succeed, or can produce an error. When an * "smc" request completes this value is found in r12; it should * always be SEC_EXIT_NORMAL. * * In addition, the particular service performed produces a result. * The values that should be expected depend on the service. We * therefore return this value to the caller, so it can handle the * request result appropriately. This result value is found in r0 * when the "smc" request completes.
*/ staticint bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
{ register u32 ip asm("ip"); /* Also called r12 */ register u32 r0 asm("r0"); register u32 r4 asm("r4"); register u32 r5 asm("r5"); register u32 r6 asm("r6");
r4 = service_id;
r5 = 0x3; /* Keep IRQ and FIQ off in SM */
r6 = buffer_phys;
/* __bcm_kona_smc() should only run on CPU 0, with pre-emption disabled */ staticvoid __bcm_kona_smc(void *info)
{ struct bcm_kona_smc_data *data = info;
u32 __iomem *args = bcm_smc_buffer;
BUG_ON(smp_processor_id() != 0);
BUG_ON(!args);
/* Copy the four 32 bit argument values into the bounce area */
writel_relaxed(data->arg0, args++);
writel_relaxed(data->arg1, args++);
writel_relaxed(data->arg2, args++);
writel(data->arg3, args);
/* Flush caches for input data passed to Secure Monitor */
flush_cache_all();
/* Trap into Secure Monitor and record the request result */
data->result = bcm_kona_do_smc(data->service_id, bcm_smc_buffer_phys);
}
/* * Due to a limitation of the secure monitor, we must use the SMP * infrastructure to forward all secure monitor calls to Core 0.
*/
smp_call_function_single(0, __bcm_kona_smc, &data, 1);
return data.result;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.25 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.