xref: /rk3399_ARM-atf/plat/nvidia/tegra/soc/t194/plat_memctrl.c (revision 7e491133fcf8368a6ff202197f6fd81ac320538d)
1719fdb6eSVarun Wadekar /*
2c766adceSPritesh Raithatha  * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
3719fdb6eSVarun Wadekar  *
4719fdb6eSVarun Wadekar  * SPDX-License-Identifier: BSD-3-Clause
5719fdb6eSVarun Wadekar  */
6719fdb6eSVarun Wadekar 
7f32e8525SVarun Wadekar #include <assert.h>
8f32e8525SVarun Wadekar #include <common/bl_common.h>
9f32e8525SVarun Wadekar #include <mce.h>
10719fdb6eSVarun Wadekar #include <memctrl_v2.h>
11f32e8525SVarun Wadekar #include <tegra_mc_def.h>
12f32e8525SVarun Wadekar #include <tegra_platform.h>
13719fdb6eSVarun Wadekar 
14719fdb6eSVarun Wadekar /*******************************************************************************
15719fdb6eSVarun Wadekar  * Array to hold the security configs for stream IDs
16719fdb6eSVarun Wadekar  ******************************************************************************/
17719fdb6eSVarun Wadekar const static mc_streamid_security_cfg_t tegra194_streamid_sec_cfgs[] = {
18de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(PTCR, NON_SECURE, OVERRIDE, DISABLE),
1956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(HDAR, NON_SECURE, OVERRIDE, DISABLE),
2056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(HOST1XDMAR, NON_SECURE, NO_OVERRIDE, DISABLE),
2156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVENCSRD, NON_SECURE, NO_OVERRIDE, DISABLE),
2256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SATAR, NON_SECURE, OVERRIDE, DISABLE),
23de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(MPCORER, NON_SECURE, OVERRIDE, DISABLE),
2456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVENCSWR, NON_SECURE, NO_OVERRIDE, DISABLE),
2556e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(HDAW, NON_SECURE, OVERRIDE, DISABLE),
26de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(MPCOREW, NON_SECURE, OVERRIDE, DISABLE),
2756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SATAW, NON_SECURE, OVERRIDE, DISABLE),
28719fdb6eSVarun Wadekar 	mc_make_sec_cfg(ISPRA, NON_SECURE, NO_OVERRIDE, ENABLE),
29719fdb6eSVarun Wadekar 	mc_make_sec_cfg(ISPFALR, NON_SECURE, NO_OVERRIDE, ENABLE),
30719fdb6eSVarun Wadekar 	mc_make_sec_cfg(ISPWA, NON_SECURE, NO_OVERRIDE, ENABLE),
31719fdb6eSVarun Wadekar 	mc_make_sec_cfg(ISPWB, NON_SECURE, NO_OVERRIDE, ENABLE),
32bc019041SAjay Gupta 	mc_make_sec_cfg(XUSB_HOSTR, NON_SECURE, NO_OVERRIDE, ENABLE),
33bc019041SAjay Gupta 	mc_make_sec_cfg(XUSB_HOSTW, NON_SECURE, NO_OVERRIDE, ENABLE),
34bc019041SAjay Gupta 	mc_make_sec_cfg(XUSB_DEVR, NON_SECURE, NO_OVERRIDE, ENABLE),
35bc019041SAjay Gupta 	mc_make_sec_cfg(XUSB_DEVW, NON_SECURE, NO_OVERRIDE, ENABLE),
3656e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(TSECSRD, NON_SECURE, NO_OVERRIDE, DISABLE),
3756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(TSECSWR, NON_SECURE, NO_OVERRIDE, DISABLE),
3856e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SDMMCRA, NON_SECURE, OVERRIDE, DISABLE),
3956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SDMMCR, NON_SECURE, OVERRIDE, DISABLE),
4056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SDMMCRAB, NON_SECURE, OVERRIDE, DISABLE),
4156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SDMMCWA, NON_SECURE, OVERRIDE, DISABLE),
4256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SDMMCW, NON_SECURE, OVERRIDE, DISABLE),
4356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SDMMCWAB, NON_SECURE, OVERRIDE, DISABLE),
4456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(VICSRD, NON_SECURE, NO_OVERRIDE, DISABLE),
4556e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(VICSWR, NON_SECURE, NO_OVERRIDE, DISABLE),
46719fdb6eSVarun Wadekar 	mc_make_sec_cfg(VIW, NON_SECURE, NO_OVERRIDE, ENABLE),
4756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVDECSRD, NON_SECURE, NO_OVERRIDE, DISABLE),
4856e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVDECSWR, NON_SECURE, NO_OVERRIDE, DISABLE),
4956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(APER, NON_SECURE, NO_OVERRIDE, DISABLE),
5056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(APEW, NON_SECURE, NO_OVERRIDE, DISABLE),
5156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVJPGSRD, NON_SECURE, NO_OVERRIDE, DISABLE),
5256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVJPGSWR, NON_SECURE, NO_OVERRIDE, DISABLE),
5356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SESRD, NON_SECURE, NO_OVERRIDE, DISABLE),
5456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SESWR, NON_SECURE, NO_OVERRIDE, DISABLE),
5556e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(AXIAPR, NON_SECURE, OVERRIDE, DISABLE),
5656e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(AXIAPW, NON_SECURE, OVERRIDE, DISABLE),
5756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(ETRR, NON_SECURE, OVERRIDE, DISABLE),
5856e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(ETRW, NON_SECURE, OVERRIDE, DISABLE),
5956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(TSECSRDB, NON_SECURE, NO_OVERRIDE, DISABLE),
6056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(TSECSWRB, NON_SECURE, NO_OVERRIDE, DISABLE),
61719fdb6eSVarun Wadekar 	mc_make_sec_cfg(AXISR, SECURE, NO_OVERRIDE, DISABLE),
62719fdb6eSVarun Wadekar 	mc_make_sec_cfg(AXISW, SECURE, NO_OVERRIDE, DISABLE),
6356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(EQOSR, NON_SECURE, OVERRIDE, DISABLE),
6456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(EQOSW, NON_SECURE, OVERRIDE, DISABLE),
6556e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(UFSHCR, NON_SECURE, OVERRIDE, DISABLE),
6656e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(UFSHCW, NON_SECURE, OVERRIDE, DISABLE),
6756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVDISPLAYR, NON_SECURE, OVERRIDE, DISABLE),
6856e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(BPMPR, NON_SECURE, NO_OVERRIDE, DISABLE),
6956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(BPMPW, NON_SECURE, NO_OVERRIDE, DISABLE),
7056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(BPMPDMAR, NON_SECURE, NO_OVERRIDE, DISABLE),
7156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(BPMPDMAW, NON_SECURE, NO_OVERRIDE, DISABLE),
7256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(AONR, NON_SECURE, NO_OVERRIDE, DISABLE),
7356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(AONW, NON_SECURE, NO_OVERRIDE, DISABLE),
7456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(AONDMAR, NON_SECURE, NO_OVERRIDE, DISABLE),
7556e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(AONDMAW, NON_SECURE, NO_OVERRIDE, DISABLE),
7656e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SCER, NON_SECURE, NO_OVERRIDE, DISABLE),
7756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SCEW, NON_SECURE, NO_OVERRIDE, DISABLE),
7856e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SCEDMAR, NON_SECURE, NO_OVERRIDE, DISABLE),
7956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(SCEDMAW, NON_SECURE, NO_OVERRIDE, DISABLE),
8056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(APEDMAR, NON_SECURE, NO_OVERRIDE, DISABLE),
8156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(APEDMAW, NON_SECURE, NO_OVERRIDE, DISABLE),
8256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVDISPLAYR1, NON_SECURE, OVERRIDE, DISABLE),
8356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(VICSRD1, NON_SECURE, NO_OVERRIDE, DISABLE),
8456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVDECSRD1, NON_SECURE, NO_OVERRIDE, DISABLE),
85719fdb6eSVarun Wadekar 	mc_make_sec_cfg(VIFALR, NON_SECURE, NO_OVERRIDE, ENABLE),
86719fdb6eSVarun Wadekar 	mc_make_sec_cfg(VIFALW, NON_SECURE, NO_OVERRIDE, ENABLE),
8756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(DLA0RDA, NON_SECURE, NO_OVERRIDE, DISABLE),
8856e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(DLA0FALRDB, NON_SECURE, NO_OVERRIDE, DISABLE),
8956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(DLA0WRA, NON_SECURE, NO_OVERRIDE, DISABLE),
9056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(DLA0FALWRB, NON_SECURE, NO_OVERRIDE, DISABLE),
9156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(DLA1RDA, NON_SECURE, NO_OVERRIDE, DISABLE),
9256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(DLA1FALRDB, NON_SECURE, NO_OVERRIDE, DISABLE),
9356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(DLA1WRA, NON_SECURE, NO_OVERRIDE, DISABLE),
9456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(DLA1FALWRB, NON_SECURE, NO_OVERRIDE, DISABLE),
9556e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA0RDA, NON_SECURE, NO_OVERRIDE, DISABLE),
9656e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA0RDB, NON_SECURE, NO_OVERRIDE, DISABLE),
9756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA0RDC, NON_SECURE, NO_OVERRIDE, DISABLE),
9856e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA0WRA, NON_SECURE, NO_OVERRIDE, DISABLE),
9956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA0WRB, NON_SECURE, NO_OVERRIDE, DISABLE),
10056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA0WRC, NON_SECURE, NO_OVERRIDE, DISABLE),
10156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA1RDA, NON_SECURE, NO_OVERRIDE, DISABLE),
10256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA1RDB, NON_SECURE, NO_OVERRIDE, DISABLE),
10356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA1RDC, NON_SECURE, NO_OVERRIDE, DISABLE),
10456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA1WRA, NON_SECURE, NO_OVERRIDE, DISABLE),
10556e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA1WRB, NON_SECURE, NO_OVERRIDE, DISABLE),
10656e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA1WRC, NON_SECURE, NO_OVERRIDE, DISABLE),
10756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(RCER, NON_SECURE, NO_OVERRIDE, DISABLE),
10856e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(RCEW, NON_SECURE, NO_OVERRIDE, DISABLE),
10956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(RCEDMAR, NON_SECURE, NO_OVERRIDE, DISABLE),
11056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(RCEDMAW, NON_SECURE, NO_OVERRIDE, DISABLE),
11156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVENC1SRD, NON_SECURE, NO_OVERRIDE, DISABLE),
11256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVENC1SWR, NON_SECURE, NO_OVERRIDE, DISABLE),
11356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE0R, NON_SECURE, OVERRIDE, DISABLE),
11456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE0W, NON_SECURE, OVERRIDE, DISABLE),
11556e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE1R, NON_SECURE, OVERRIDE, DISABLE),
11656e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE1W, NON_SECURE, OVERRIDE, DISABLE),
11756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE2AR, NON_SECURE, OVERRIDE, DISABLE),
11856e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE2AW, NON_SECURE, OVERRIDE, DISABLE),
11956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE3R, NON_SECURE, OVERRIDE, DISABLE),
12056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE3W, NON_SECURE, OVERRIDE, DISABLE),
12156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE4R, NON_SECURE, OVERRIDE, DISABLE),
12256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE4W, NON_SECURE, OVERRIDE, DISABLE),
12356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE5R, NON_SECURE, OVERRIDE, DISABLE),
12456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE5W, NON_SECURE, OVERRIDE, DISABLE),
125719fdb6eSVarun Wadekar 	mc_make_sec_cfg(ISPFALW, NON_SECURE, NO_OVERRIDE, ENABLE),
12656e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(DLA0RDA1, NON_SECURE, NO_OVERRIDE, DISABLE),
12756e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(DLA1RDA1, NON_SECURE, NO_OVERRIDE, DISABLE),
12856e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA0RDA1, NON_SECURE, NO_OVERRIDE, DISABLE),
12956e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA0RDB1, NON_SECURE, NO_OVERRIDE, DISABLE),
13056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA1RDA1, NON_SECURE, NO_OVERRIDE, DISABLE),
13156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PVA1RDB1, NON_SECURE, NO_OVERRIDE, DISABLE),
13256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE5R1, NON_SECURE, OVERRIDE, DISABLE),
13356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVENCSRD1, NON_SECURE, NO_OVERRIDE, DISABLE),
13456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(NVENC1SRD1, NON_SECURE, NO_OVERRIDE, DISABLE),
135719fdb6eSVarun Wadekar 	mc_make_sec_cfg(ISPRA1, NON_SECURE, NO_OVERRIDE, ENABLE),
13656e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(PCIE0R1, NON_SECURE, OVERRIDE, DISABLE),
137de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(NVDEC1SRD, NON_SECURE, NO_OVERRIDE, DISABLE),
138de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(NVDEC1SRD1, NON_SECURE, NO_OVERRIDE, DISABLE),
139de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(NVDEC1SWR, NON_SECURE, NO_OVERRIDE, DISABLE),
14056e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(MIU0R, NON_SECURE, OVERRIDE, DISABLE),
14156e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(MIU0W, NON_SECURE, OVERRIDE, DISABLE),
14256e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(MIU1R, NON_SECURE, OVERRIDE, DISABLE),
14356e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(MIU1W, NON_SECURE, OVERRIDE, DISABLE),
14456e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(MIU2R, NON_SECURE, OVERRIDE, DISABLE),
14556e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(MIU2W, NON_SECURE, OVERRIDE, DISABLE),
14656e7d6a7SPritesh Raithatha 	mc_make_sec_cfg(MIU3R, NON_SECURE, OVERRIDE, DISABLE),
147a69a30ffSPravin 	mc_make_sec_cfg(MIU3W, NON_SECURE, OVERRIDE, DISABLE),
148a69a30ffSPravin 	mc_make_sec_cfg(MIU4R, NON_SECURE, OVERRIDE, DISABLE),
149a69a30ffSPravin 	mc_make_sec_cfg(MIU4W, NON_SECURE, OVERRIDE, DISABLE),
150a69a30ffSPravin 	mc_make_sec_cfg(MIU5R, NON_SECURE, OVERRIDE, DISABLE),
151de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(MIU5W, NON_SECURE, OVERRIDE, DISABLE),
152de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(MIU6R, NON_SECURE, OVERRIDE, DISABLE),
153de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(MIU6W, NON_SECURE, OVERRIDE, DISABLE),
154de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(MIU7R, NON_SECURE, OVERRIDE, DISABLE),
155de3fd9b3SPritesh Raithatha 	mc_make_sec_cfg(MIU7W, NON_SECURE, OVERRIDE, DISABLE)
156719fdb6eSVarun Wadekar };
157719fdb6eSVarun Wadekar 
158719fdb6eSVarun Wadekar /*******************************************************************************
159a391d494SPritesh Raithatha  * Array to hold MC context for Tegra194
160a391d494SPritesh Raithatha  ******************************************************************************/
161a391d494SPritesh Raithatha static __attribute__((aligned(16))) mc_regs_t tegra194_mc_context[] = {
162a391d494SPritesh Raithatha 	_START_OF_TABLE_,
163a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(HDAR),
164a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(HOST1XDMAR),
165a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVENCSRD),
166a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SATAR),
167a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVENCSWR),
168a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(HDAW),
169a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SATAW),
170a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(ISPRA),
171a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(ISPFALR),
172a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(ISPWA),
173a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(ISPWB),
174a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(XUSB_HOSTR),
175a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(XUSB_HOSTW),
176a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(XUSB_DEVR),
177a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(XUSB_DEVW),
178a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(TSECSRD),
179a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(TSECSWR),
180a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SDMMCRA),
181a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SDMMCR),
182a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SDMMCRAB),
183a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SDMMCWA),
184a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SDMMCW),
185a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SDMMCWAB),
186a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(VICSRD),
187a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(VICSWR),
188a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(VIW),
189a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVDECSRD),
190a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVDECSWR),
191a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(APER),
192a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(APEW),
193a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVJPGSRD),
194a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVJPGSWR),
195a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SESRD),
196a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SESWR),
197a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(AXIAPR),
198a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(AXIAPW),
199a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(ETRR),
200a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(ETRW),
201a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(TSECSRDB),
202a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(TSECSWRB),
203a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(AXISR),
204a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(AXISW),
205a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(EQOSR),
206a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(EQOSW),
207a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(UFSHCR),
208a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(UFSHCW),
209a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVDISPLAYR),
210a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(BPMPR),
211a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(BPMPW),
212a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(BPMPDMAR),
213a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(BPMPDMAW),
214a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(AONR),
215a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(AONW),
216a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(AONDMAR),
217a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(AONDMAW),
218a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SCER),
219a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SCEW),
220a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SCEDMAR),
221a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(SCEDMAW),
222a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(APEDMAR),
223a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(APEDMAW),
224a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVDISPLAYR1),
225a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(VICSRD1),
226a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVDECSRD1),
227a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(VIFALR),
228a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(VIFALW),
229a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(DLA0RDA),
230a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(DLA0FALRDB),
231a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(DLA0WRA),
232a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(DLA0FALWRB),
233a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(DLA1RDA),
234a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(DLA1FALRDB),
235a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(DLA1WRA),
236a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(DLA1FALWRB),
237a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA0RDA),
238a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA0RDB),
239a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA0RDC),
240a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA0WRA),
241a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA0WRB),
242a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA0WRC),
243a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA1RDA),
244a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA1RDB),
245a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA1RDC),
246a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA1WRA),
247a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA1WRB),
248a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA1WRC),
249a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(RCER),
250a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(RCEW),
251a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(RCEDMAR),
252a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(RCEDMAW),
253a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVENC1SRD),
254a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVENC1SWR),
255a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE0R),
256a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE0W),
257a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE1R),
258a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE1W),
259a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE2AR),
260a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE2AW),
261a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE3R),
262a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE3W),
263a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE4R),
264a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE4W),
265a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE5R),
266a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE5W),
267a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(ISPFALW),
268a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(DLA0RDA1),
269a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(DLA1RDA1),
270a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA0RDA1),
271a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA0RDB1),
272a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA1RDA1),
273a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PVA1RDB1),
274a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE5R1),
275a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVENCSRD1),
276a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(NVENC1SRD1),
277a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(ISPRA1),
278a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(PCIE0R1),
279a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(MIU0R),
280a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(MIU0W),
281a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(MIU1R),
282a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(MIU1W),
283a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(MIU2R),
284a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(MIU2W),
285a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(MIU3R),
286a391d494SPritesh Raithatha 	mc_make_sid_security_cfg(MIU3W),
287a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(HDAR),
288a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(HOST1XDMAR),
289a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVENCSRD),
290a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SATAR),
291a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVENCSWR),
292a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(HDAW),
293a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SATAW),
294a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(ISPRA),
295a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(ISPFALR),
296a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(ISPWA),
297a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(ISPWB),
298a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(XUSB_HOSTR),
299a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(XUSB_HOSTW),
300a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(XUSB_DEVR),
301a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(XUSB_DEVW),
302a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(TSECSRD),
303a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(TSECSWR),
304a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SDMMCRA),
305a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SDMMCR),
306a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SDMMCRAB),
307a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SDMMCWA),
308a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SDMMCW),
309a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SDMMCWAB),
310a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(VICSRD),
311a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(VICSWR),
312a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(VIW),
313a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVDECSRD),
314a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVDECSWR),
315a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(APER),
316a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(APEW),
317a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVJPGSRD),
318a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVJPGSWR),
319a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SESRD),
320a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SESWR),
321a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(AXIAPR),
322a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(AXIAPW),
323a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(ETRR),
324a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(ETRW),
325a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(TSECSRDB),
326a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(TSECSWRB),
327a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(AXISR),
328a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(AXISW),
329a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(EQOSR),
330a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(EQOSW),
331a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(UFSHCR),
332a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(UFSHCW),
333a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVDISPLAYR),
334a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(BPMPR),
335a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(BPMPW),
336a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(BPMPDMAR),
337a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(BPMPDMAW),
338a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(AONR),
339a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(AONW),
340a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(AONDMAR),
341a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(AONDMAW),
342a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SCER),
343a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SCEW),
344a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SCEDMAR),
345a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(SCEDMAW),
346a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(APEDMAR),
347a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(APEDMAW),
348a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVDISPLAYR1),
349a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(VICSRD1),
350a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVDECSRD1),
351a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(VIFALR),
352a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(VIFALW),
353a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(DLA0RDA),
354a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(DLA0FALRDB),
355a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(DLA0WRA),
356a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(DLA0FALWRB),
357a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(DLA1RDA),
358a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(DLA1FALRDB),
359a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(DLA1WRA),
360a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(DLA1FALWRB),
361a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA0RDA),
362a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA0RDB),
363a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA0RDC),
364a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA0WRA),
365a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA0WRB),
366a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA0WRC),
367a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA1RDA),
368a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA1RDB),
369a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA1RDC),
370a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA1WRA),
371a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA1WRB),
372a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA1WRC),
373a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(RCER),
374a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(RCEW),
375a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(RCEDMAR),
376a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(RCEDMAW),
377a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVENC1SRD),
378a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVENC1SWR),
379a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE0R),
380a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE0W),
381a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE1R),
382a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE1W),
383a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE2AR),
384a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE2AW),
385a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE3R),
386a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE3W),
387a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE4R),
388a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE4W),
389a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE5R),
390a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE5W),
391a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(ISPFALW),
392a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(DLA0RDA1),
393a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(DLA1RDA1),
394a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA0RDA1),
395a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA0RDB1),
396a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA1RDA1),
397a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PVA1RDB1),
398a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE5R1),
399a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVENCSRD1),
400a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(NVENC1SRD1),
401a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(ISPRA1),
402a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(PCIE0R1),
403a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(MIU0R),
404a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(MIU0W),
405a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(MIU1R),
406a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(MIU1W),
407a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(MIU2R),
408a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(MIU2W),
409a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(MIU3R),
410a391d494SPritesh Raithatha 	mc_make_sid_override_cfg(MIU3W),
411a391d494SPritesh Raithatha 	mc_smmu_bypass_cfg,	/* TBU settings */
412a391d494SPritesh Raithatha 	_END_OF_TABLE_,
413a391d494SPritesh Raithatha };
414a391d494SPritesh Raithatha 
415a391d494SPritesh Raithatha /*******************************************************************************
416a391d494SPritesh Raithatha  * Handler to return the pointer to the MC's context struct
417a391d494SPritesh Raithatha  ******************************************************************************/
418a391d494SPritesh Raithatha static mc_regs_t *tegra194_get_mc_system_suspend_ctx(void)
419a391d494SPritesh Raithatha {
420a391d494SPritesh Raithatha 	/* index of _END_OF_TABLE_ */
421a391d494SPritesh Raithatha 	tegra194_mc_context[0].val = (uint32_t)ARRAY_SIZE(tegra194_mc_context) - 1U;
422a391d494SPritesh Raithatha 
423a391d494SPritesh Raithatha 	return tegra194_mc_context;
424a391d494SPritesh Raithatha }
425a391d494SPritesh Raithatha 
426a391d494SPritesh Raithatha /*******************************************************************************
427719fdb6eSVarun Wadekar  * Struct to hold the memory controller settings
428719fdb6eSVarun Wadekar  ******************************************************************************/
429719fdb6eSVarun Wadekar static tegra_mc_settings_t tegra194_mc_settings = {
430719fdb6eSVarun Wadekar 	.streamid_security_cfg = tegra194_streamid_sec_cfgs,
431a391d494SPritesh Raithatha 	.num_streamid_security_cfgs = (uint32_t)ARRAY_SIZE(tegra194_streamid_sec_cfgs),
432a391d494SPritesh Raithatha 	.get_mc_system_suspend_ctx = tegra194_get_mc_system_suspend_ctx
433719fdb6eSVarun Wadekar };
434719fdb6eSVarun Wadekar 
435719fdb6eSVarun Wadekar /*******************************************************************************
436719fdb6eSVarun Wadekar  * Handler to return the pointer to the memory controller's settings struct
437719fdb6eSVarun Wadekar  ******************************************************************************/
438719fdb6eSVarun Wadekar tegra_mc_settings_t *tegra_get_mc_settings(void)
439719fdb6eSVarun Wadekar {
440719fdb6eSVarun Wadekar 	return &tegra194_mc_settings;
441719fdb6eSVarun Wadekar }
4424e697b77SSteven Kao 
4434e697b77SSteven Kao /*******************************************************************************
4444e697b77SSteven Kao  * Handler to program the scratch registers with TZDRAM settings for the
4454e697b77SSteven Kao  * resume firmware
4464e697b77SSteven Kao  ******************************************************************************/
4474e697b77SSteven Kao void plat_memctrl_tzdram_setup(uint64_t phys_base, uint64_t size_in_bytes)
4484e697b77SSteven Kao {
44995397d96SSteven Kao 	uint32_t sec_reg_ctrl = tegra_mc_read_32(MC_SECURITY_CFG_REG_CTRL_0);
450*7e491133SVarun Wadekar 	uint32_t phys_base_lo = (uint32_t)phys_base & 0xFFF00000;
451*7e491133SVarun Wadekar 	uint32_t phys_base_hi = (uint32_t)(phys_base >> 32);
45295397d96SSteven Kao 
4534e697b77SSteven Kao 	/*
45495397d96SSteven Kao 	 * Check TZDRAM carveout register access status. Setup TZDRAM fence
45595397d96SSteven Kao 	 * only if access is enabled.
4564e697b77SSteven Kao 	 */
45795397d96SSteven Kao 	if ((sec_reg_ctrl & SECURITY_CFG_WRITE_ACCESS_BIT) ==
45895397d96SSteven Kao 	     SECURITY_CFG_WRITE_ACCESS_ENABLE) {
4594e697b77SSteven Kao 
4604e697b77SSteven Kao 		/*
4614e697b77SSteven Kao 		 * Setup the Memory controller to allow only secure accesses to
4624e697b77SSteven Kao 		 * the TZDRAM carveout
4634e697b77SSteven Kao 		 */
4644e697b77SSteven Kao 		INFO("Configuring TrustZone DRAM Memory Carveout\n");
4654e697b77SSteven Kao 
466*7e491133SVarun Wadekar 		tegra_mc_write_32(MC_SECURITY_CFG0_0, phys_base_lo);
467*7e491133SVarun Wadekar 		tegra_mc_write_32(MC_SECURITY_CFG3_0, phys_base_hi);
4684e697b77SSteven Kao 		tegra_mc_write_32(MC_SECURITY_CFG1_0, (uint32_t)(size_in_bytes >> 20));
4694e697b77SSteven Kao 
4704e697b77SSteven Kao 		/*
4714e697b77SSteven Kao 		 * MCE propagates the security configuration values across the
4724e697b77SSteven Kao 		 * CCPLEX.
4734e697b77SSteven Kao 		 */
4744e697b77SSteven Kao 		(void)mce_update_gsc_tzdram();
4754e697b77SSteven Kao 	}
4764e697b77SSteven Kao }
477