summaryrefslogtreecommitdiffstats
path: root/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/arm-trusted-firmware/files/0001-plat-renesas-rcar-Make-RPC-secure-settings-optional.patch
blob: 54d50efb2ac657061dfcb04dab6c7e9a5a38e875 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
From a473ace625dbb8e7d48ce12d209809cc3db93386 Mon Sep 17 00:00:00 2001
From: Valentine Barshak <valentine.barshak@cogentembedded.com>
Date: Wed, 8 Aug 2018 14:43:40 +0300
Subject: [PATCH 1/5] plat: renesas: rcar: Make RPC secure settings optional

This adds RCAR_DISABLE_NONSECURE_RPC_ACCESS make variable which
disables non-secure RPC access when set to a non-zero value.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 plat/renesas/rcar/bl2_secure_setting.c |  4 ++++
 plat/renesas/rcar/bl31_rcar_setup.c    | 16 ++++++++++++++++
 plat/renesas/rcar/platform.mk          |  6 ++++++
 3 files changed, 26 insertions(+)

diff --git a/plat/renesas/rcar/bl2_secure_setting.c b/plat/renesas/rcar/bl2_secure_setting.c
index 2469780..6f6c374 100644
--- a/plat/renesas/rcar/bl2_secure_setting.c
+++ b/plat/renesas/rcar/bl2_secure_setting.c
@@ -91,7 +91,9 @@ static const struct {
 	/** Security attribute setting for slave ports 13 */
 	/* Bit22: RPC slave ports. */
 	/*        0: registers can be accessed from secure resource only. */
+#if (RCAR_DISABLE_NONSECURE_RPC_ACCESS != 0)
 	{SEC_SEL13,		0xFFBFFFFFU},
+#endif
 
 	/** Security attribute setting for slave ports 14 */
 	/* Bit27: System Timer (SCMT) slave ports. */
@@ -222,8 +224,10 @@ static const struct {
 	/** Security group 1 attribute setting for slave ports 13 */
 	/* Bit22: RPC slave ports. */
 	/*        SecurityGroup3 */
+#if (RCAR_DISABLE_NONSECURE_RPC_ACCESS != 0)
 	{SEC_GRP0COND13,	0x00400000U},
 	{SEC_GRP1COND13,	0x00400000U},
+#endif
 
 	/** Security group 0 attribute setting for slave ports 14 */
 	/** Security group 1 attribute setting for slave ports 14 */
diff --git a/plat/renesas/rcar/bl31_rcar_setup.c b/plat/renesas/rcar/bl31_rcar_setup.c
index 03b3d36..c35ae66 100644
--- a/plat/renesas/rcar/bl31_rcar_setup.c
+++ b/plat/renesas/rcar/bl31_rcar_setup.c
@@ -216,3 +216,19 @@ uint32_t bl31_plat_boot_mpidr_chk(void)
 	return rc;
 }
 
+/*******************************************************************************
+ * Perform the runtime platform specific setup here.
+ ******************************************************************************/
+void bl31_plat_runtime_setup(void)
+{
+#if (RCAR_DISABLE_NONSECURE_RPC_ACCESS == 0)
+	/* Enable non-secure access to the RPC HyperFlash region. */
+	mmio_write_32(0xee2000b8, 0x155);
+	mmio_write_32(0xee200000, mmio_read_32(0xee200000) & 0x7fffffff);
+#endif
+	/*
+	 * Finish the use of console driver in BL31 so that any runtime logs
+	 * from BL31 will be suppressed.
+	 */
+	console_uninit();
+}
diff --git a/plat/renesas/rcar/platform.mk b/plat/renesas/rcar/platform.mk
index a8b4672..3cac10a 100644
--- a/plat/renesas/rcar/platform.mk
+++ b/plat/renesas/rcar/platform.mk
@@ -392,6 +392,12 @@ PROGRAMMABLE_RESET_ADDRESS	:=	1
 COLD_BOOT_SINGLE_CPU		:=	1
 #endif /* IMAGE_BL2 */
 
+# Process RCAR_DISABLE_NONSECURE_RPC_ACCESS flag
+ifndef RCAR_DISABLE_NONSECURE_RPC_ACCESS
+RCAR_DISABLE_NONSECURE_RPC_ACCESS := 0
+endif
+$(eval $(call add_define,RCAR_DISABLE_NONSECURE_RPC_ACCESS))
+
 include plat/renesas/rcar/ddr/ddr.mk
 include plat/renesas/rcar/qos/qos.mk
 include plat/renesas/rcar/pfc/pfc.mk
-- 
2.7.4