xref: /rk3399_ARM-atf/plat/arm/board/tc/tc_trng.c (revision 7be391d1ce5683c717fcf2be584f3d294ebc2bf3)
1*7be391d1SDavid Vincze /*
2*7be391d1SDavid Vincze  * Copyright (c) 2017-2024, ARM Limited and Contributors. All rights reserved.
3*7be391d1SDavid Vincze  *
4*7be391d1SDavid Vincze  * SPDX-License-Identifier: BSD-3-Clause
5*7be391d1SDavid Vincze  */
6*7be391d1SDavid Vincze 
7*7be391d1SDavid Vincze #include <arm_acle.h>
8*7be391d1SDavid Vincze #include <assert.h>
9*7be391d1SDavid Vincze #include <stdbool.h>
10*7be391d1SDavid Vincze #include <stdint.h>
11*7be391d1SDavid Vincze #include <string.h>
12*7be391d1SDavid Vincze 
13*7be391d1SDavid Vincze #include <lib/mmio.h>
14*7be391d1SDavid Vincze #include <lib/smccc.h>
15*7be391d1SDavid Vincze #include <lib/utils_def.h>
16*7be391d1SDavid Vincze #include <plat/common/platform.h>
17*7be391d1SDavid Vincze #include <platform_def.h>
18*7be391d1SDavid Vincze #include <services/trng_svc.h>
19*7be391d1SDavid Vincze #include <smccc_helpers.h>
20*7be391d1SDavid Vincze 
21*7be391d1SDavid Vincze DEFINE_SVC_UUID2(_plat_trng_uuid,
22*7be391d1SDavid Vincze 	0x23523c58, 0x7448, 0x4083, 0x9d, 0x16,
23*7be391d1SDavid Vincze 	0xe3, 0xfa, 0xb9, 0xf1, 0x73, 0xbc
24*7be391d1SDavid Vincze );
25*7be391d1SDavid Vincze uuid_t plat_trng_uuid;
26*7be391d1SDavid Vincze 
27*7be391d1SDavid Vincze /* Dummy implementation */
28*7be391d1SDavid Vincze bool plat_get_entropy(uint64_t *out)
29*7be391d1SDavid Vincze {
30*7be391d1SDavid Vincze 	*out = 0xABBAEDDAACDCDEAD;
31*7be391d1SDavid Vincze 
32*7be391d1SDavid Vincze 	return true;
33*7be391d1SDavid Vincze }
34*7be391d1SDavid Vincze 
35*7be391d1SDavid Vincze void plat_entropy_setup(void)
36*7be391d1SDavid Vincze {
37*7be391d1SDavid Vincze 	uint64_t dummy;
38*7be391d1SDavid Vincze 
39*7be391d1SDavid Vincze 	plat_trng_uuid = _plat_trng_uuid;
40*7be391d1SDavid Vincze 
41*7be391d1SDavid Vincze 	/* Initialise the entropy source and trigger RNG generation */
42*7be391d1SDavid Vincze 	plat_get_entropy(&dummy);
43*7be391d1SDavid Vincze }
44