blob: e1203144198469ee3d31e76255d06e5b07ca4d32 [file] [log] [blame]
Varun Wadekarcd5a2f52015-09-20 15:08:22 +05301/*
Harvey Hsiehb9b374f2016-11-15 22:04:51 +08002 * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
Varun Wadekarcd5a2f52015-09-20 15:08:22 +05303 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Varun Wadekarcd5a2f52015-09-20 15:08:22 +05305 */
6
Varun Wadekarcd5a2f52015-09-20 15:08:22 +05307#include <assert.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008#include <string.h>
9
10#include <arch_helpers.h>
11#include <common/bl_common.h>
12#include <common/debug.h>
13#include <lib/mmio.h>
14#include <lib/utils.h>
15#include <lib/xlat_tables/xlat_tables_v2.h>
16
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053017#include <mce.h>
18#include <memctrl.h>
19#include <memctrl_v2.h>
Varun Wadekar87e44ff2016-03-03 13:22:39 -080020#include <smmu.h>
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053021#include <tegra_def.h>
Varun Wadekare81177d2016-07-18 17:43:41 -070022#include <tegra_platform.h>
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053023
24/* Video Memory base and size (live values) */
25static uint64_t video_mem_base;
Varun Wadekar7058aee2016-04-25 09:01:46 -070026static uint64_t video_mem_size_mb;
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053027
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053028/*
Varun Wadekar87e44ff2016-03-03 13:22:39 -080029 * Init Memory controller during boot.
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053030 */
31void tegra_memctrl_setup(void)
32{
33 uint32_t val;
Pritesh Raithatha9eb5db52017-01-02 19:42:31 +053034 const uint32_t *mc_streamid_override_regs;
35 uint32_t num_streamid_override_regs;
36 const mc_streamid_security_cfg_t *mc_streamid_sec_cfgs;
37 uint32_t num_streamid_sec_cfgs;
Anthony Zhou0844b972017-06-28 16:35:54 +080038 const tegra_mc_settings_t *plat_mc_settings = tegra_get_mc_settings();
Varun Wadekarad45ef72017-04-03 13:44:57 -070039 uint32_t i;
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053040
41 INFO("Tegra Memory Controller (v2)\n");
42
Varun Wadekar6cb25f92016-12-19 11:17:54 -080043#if ENABLE_SMMU_DEVICE
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053044 /* Program the SMMU pagesize */
Varun Wadekar87e44ff2016-03-03 13:22:39 -080045 tegra_smmu_init();
Varun Wadekar6cb25f92016-12-19 11:17:54 -080046#endif
Pritesh Raithatha9eb5db52017-01-02 19:42:31 +053047 /* Get the settings from the platform */
Anthony Zhou4408e882017-07-07 14:29:51 +080048 assert(plat_mc_settings != NULL);
Pritesh Raithatha9eb5db52017-01-02 19:42:31 +053049 mc_streamid_override_regs = plat_mc_settings->streamid_override_cfg;
50 num_streamid_override_regs = plat_mc_settings->num_streamid_override_cfgs;
51 mc_streamid_sec_cfgs = plat_mc_settings->streamid_security_cfg;
52 num_streamid_sec_cfgs = plat_mc_settings->num_streamid_security_cfgs;
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053053
54 /* Program all the Stream ID overrides */
Pritesh Raithatha9eb5db52017-01-02 19:42:31 +053055 for (i = 0; i < num_streamid_override_regs; i++)
56 tegra_mc_streamid_write_32(mc_streamid_override_regs[i],
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053057 MC_STREAM_ID_MAX);
58
59 /* Program the security config settings for all Stream IDs */
Pritesh Raithatha9eb5db52017-01-02 19:42:31 +053060 for (i = 0; i < num_streamid_sec_cfgs; i++) {
61 val = mc_streamid_sec_cfgs[i].override_enable << 16 |
62 mc_streamid_sec_cfgs[i].override_client_inputs << 8 |
63 mc_streamid_sec_cfgs[i].override_client_ns_flag << 0;
64 tegra_mc_streamid_write_32(mc_streamid_sec_cfgs[i].offset, val);
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053065 }
66
67 /*
68 * All requests at boot time, and certain requests during
69 * normal run time, are physically addressed and must bypass
70 * the SMMU. The client hub logic implements a hardware bypass
71 * path around the Translation Buffer Units (TBU). During
72 * boot-time, the SMMU_BYPASS_CTRL register (which defaults to
73 * TBU_BYPASS mode) will be used to steer all requests around
74 * the uninitialized TBUs. During normal operation, this register
75 * is locked into TBU_BYPASS_SID config, which routes requests
76 * with special StreamID 0x7f on the bypass path and all others
77 * through the selected TBU. This is done to disable SMMU Bypass
78 * mode, as it could be used to circumvent SMMU security checks.
79 */
80 tegra_mc_write_32(MC_SMMU_BYPASS_CONFIG,
Pritesh Raithatha9eb5db52017-01-02 19:42:31 +053081 MC_SMMU_BYPASS_CONFIG_SETTINGS);
Varun Wadekarcd5a2f52015-09-20 15:08:22 +053082
Varun Wadekarc9ac3e42016-02-17 15:07:49 -080083 /*
Varun Wadekara0f26972016-03-11 17:18:51 -080084 * Re-configure MSS to allow ROC to deal with ordering of the
85 * Memory Controller traffic. This is needed as the Memory Controller
86 * boots with MSS having all control, but ROC provides a performance
87 * boost as compared to MSS.
88 */
Puneet Saxenacf8c0e22017-08-04 17:19:55 +053089 if (plat_mc_settings->reconfig_mss_clients != NULL) {
90 plat_mc_settings->reconfig_mss_clients();
91 }
Varun Wadekara0f26972016-03-11 17:18:51 -080092
Varun Wadekarad45ef72017-04-03 13:44:57 -070093 /* Program overrides for MC transactions */
Puneet Saxenacf8c0e22017-08-04 17:19:55 +053094 if (plat_mc_settings->set_txn_overrides != NULL) {
95 plat_mc_settings->set_txn_overrides();
96 }
Varun Wadekar87e44ff2016-03-03 13:22:39 -080097}
Varun Wadekarc9ac3e42016-02-17 15:07:49 -080098
Varun Wadekar87e44ff2016-03-03 13:22:39 -080099/*
100 * Restore Memory Controller settings after "System Suspend"
101 */
102void tegra_memctrl_restore_settings(void)
103{
Puneet Saxenacf8c0e22017-08-04 17:19:55 +0530104 const tegra_mc_settings_t *plat_mc_settings = tegra_get_mc_settings();
105
106 assert(plat_mc_settings != NULL);
107
Varun Wadekara0f26972016-03-11 17:18:51 -0800108 /*
109 * Re-configure MSS to allow ROC to deal with ordering of the
110 * Memory Controller traffic. This is needed as the Memory Controller
111 * resets during System Suspend with MSS having all control, but ROC
112 * provides a performance boost as compared to MSS.
113 */
Puneet Saxenacf8c0e22017-08-04 17:19:55 +0530114 if (plat_mc_settings->reconfig_mss_clients != NULL) {
115 plat_mc_settings->reconfig_mss_clients();
116 }
Varun Wadekara0f26972016-03-11 17:18:51 -0800117
Varun Wadekarad45ef72017-04-03 13:44:57 -0700118 /* Program overrides for MC transactions */
Puneet Saxenacf8c0e22017-08-04 17:19:55 +0530119 if (plat_mc_settings->set_txn_overrides != NULL) {
120 plat_mc_settings->set_txn_overrides();
121 }
Varun Wadekarad45ef72017-04-03 13:44:57 -0700122
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530123 /* video memory carveout region */
Anthony Zhou0e07e452017-07-26 17:16:54 +0800124 if (video_mem_base != 0ULL) {
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530125 tegra_mc_write_32(MC_VIDEO_PROTECT_BASE_LO,
126 (uint32_t)video_mem_base);
127 tegra_mc_write_32(MC_VIDEO_PROTECT_BASE_HI,
128 (uint32_t)(video_mem_base >> 32));
Varun Wadekar7058aee2016-04-25 09:01:46 -0700129 tegra_mc_write_32(MC_VIDEO_PROTECT_SIZE_MB, video_mem_size_mb);
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530130
131 /*
Varun Wadekar153982c2016-12-21 14:50:18 -0800132 * MCE propagates the VideoMem configuration values across the
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530133 * CCPLEX.
134 */
135 mce_update_gsc_videomem();
136 }
137}
138
139/*
140 * Secure the BL31 DRAM aperture.
141 *
142 * phys_base = physical base of TZDRAM aperture
143 * size_in_bytes = size of aperture in bytes
144 */
145void tegra_memctrl_tzdram_setup(uint64_t phys_base, uint32_t size_in_bytes)
146{
Harvey Hsiehb7355412017-08-09 16:24:40 +0800147 uint32_t val;
148
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530149 /*
150 * Setup the Memory controller to allow only secure accesses to
151 * the TZDRAM carveout
152 */
153 INFO("Configuring TrustZone DRAM Memory Carveout\n");
154
155 tegra_mc_write_32(MC_SECURITY_CFG0_0, (uint32_t)phys_base);
156 tegra_mc_write_32(MC_SECURITY_CFG3_0, (uint32_t)(phys_base >> 32));
157 tegra_mc_write_32(MC_SECURITY_CFG1_0, size_in_bytes >> 20);
158
159 /*
Harvey Hsiehc95802d2016-07-29 20:10:59 +0800160 * When TZ encryption enabled,
161 * We need setup TZDRAM before CPU to access TZ Carveout,
162 * otherwise CPU will fetch non-decrypted data.
Harvey Hsiehb7355412017-08-09 16:24:40 +0800163 * So save TZDRAM setting for restore by SC7 resume FW.
164 * Scratch registers map:
165 * RSV55_0 = CFG1[12:0] | CFG0[31:20]
166 * RSV55_1 = CFG3[1:0]
Harvey Hsiehc95802d2016-07-29 20:10:59 +0800167 */
168
Harvey Hsiehb7355412017-08-09 16:24:40 +0800169 val = tegra_mc_read_32(MC_SECURITY_CFG1_0) & MC_SECURITY_SIZE_MB_MASK;
Harvey Hsiehb7355412017-08-09 16:24:40 +0800170 val |= tegra_mc_read_32(MC_SECURITY_CFG0_0) & MC_SECURITY_BOM_MASK;
171 mmio_write_32(TEGRA_SCRATCH_BASE + SECURE_SCRATCH_RSV55_LO, val);
172
173 val = tegra_mc_read_32(MC_SECURITY_CFG3_0) & MC_SECURITY_BOM_HI_MASK;
174 mmio_write_32(TEGRA_SCRATCH_BASE + SECURE_SCRATCH_RSV55_HI, val);
Harvey Hsiehc95802d2016-07-29 20:10:59 +0800175
176 /*
Varun Wadekar153982c2016-12-21 14:50:18 -0800177 * MCE propagates the security configuration values across the
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530178 * CCPLEX.
179 */
180 mce_update_gsc_tzdram();
181}
182
183/*
Varun Wadekar13e7dc42015-12-30 15:15:08 -0800184 * Secure the BL31 TZRAM aperture.
185 *
186 * phys_base = physical base of TZRAM aperture
187 * size_in_bytes = size of aperture in bytes
188 */
189void tegra_memctrl_tzram_setup(uint64_t phys_base, uint32_t size_in_bytes)
190{
Varun Wadekare6d43222016-05-25 16:35:04 -0700191 uint32_t index;
192 uint32_t total_128kb_blocks = size_in_bytes >> 17;
Varun Wadekar153982c2016-12-21 14:50:18 -0800193 uint32_t residual_4kb_blocks = (size_in_bytes & (uint32_t)0x1FFFF) >> 12;
Varun Wadekar13e7dc42015-12-30 15:15:08 -0800194 uint32_t val;
195
Varun Wadekar153982c2016-12-21 14:50:18 -0800196 INFO("Configuring TrustZone SRAM Memory Carveout\n");
197
Varun Wadekar13e7dc42015-12-30 15:15:08 -0800198 /*
Varun Wadekare6d43222016-05-25 16:35:04 -0700199 * Reset the access configuration registers to restrict access
200 * to the TZRAM aperture
Varun Wadekar13e7dc42015-12-30 15:15:08 -0800201 */
Steven Kaob688d382017-09-06 13:32:21 +0800202 for (index = MC_TZRAM_CLIENT_ACCESS0_CFG0;
Varun Wadekar153982c2016-12-21 14:50:18 -0800203 index < ((uint32_t)MC_TZRAM_CARVEOUT_CFG + (uint32_t)MC_GSC_CONFIG_REGS_SIZE);
204 index += 4U) {
Varun Wadekare6d43222016-05-25 16:35:04 -0700205 tegra_mc_write_32(index, 0);
Varun Wadekar153982c2016-12-21 14:50:18 -0800206 }
Varun Wadekar13e7dc42015-12-30 15:15:08 -0800207
208 /*
Steven Kaob688d382017-09-06 13:32:21 +0800209 * Enable CPU access configuration registers to access the TZRAM aperture
210 */
211 if (!tegra_chipid_is_t186()) {
212 val = tegra_mc_read_32(MC_TZRAM_CLIENT_ACCESS1_CFG0);
213 val |= TZRAM_ALLOW_MPCORER | TZRAM_ALLOW_MPCOREW;
214 tegra_mc_write_32(MC_TZRAM_CLIENT_ACCESS1_CFG0, val);
215 }
216
217 /*
Varun Wadekare6d43222016-05-25 16:35:04 -0700218 * Set the TZRAM base. TZRAM base must be 4k aligned, at least.
219 */
Varun Wadekar153982c2016-12-21 14:50:18 -0800220 assert((phys_base & (uint64_t)0xFFF) == 0U);
Varun Wadekare6d43222016-05-25 16:35:04 -0700221 tegra_mc_write_32(MC_TZRAM_BASE_LO, (uint32_t)phys_base);
222 tegra_mc_write_32(MC_TZRAM_BASE_HI,
Varun Wadekar153982c2016-12-21 14:50:18 -0800223 (uint32_t)(phys_base >> 32) & MC_GSC_BASE_HI_MASK);
Varun Wadekar13e7dc42015-12-30 15:15:08 -0800224
Varun Wadekare6d43222016-05-25 16:35:04 -0700225 /*
226 * Set the TZRAM size
227 *
228 * total size = (number of 128KB blocks) + (number of remaining 4KB
229 * blocks)
230 *
231 */
Varun Wadekar153982c2016-12-21 14:50:18 -0800232 val = (residual_4kb_blocks << MC_GSC_SIZE_RANGE_4KB_SHIFT) |
Varun Wadekare6d43222016-05-25 16:35:04 -0700233 total_128kb_blocks;
234 tegra_mc_write_32(MC_TZRAM_SIZE, val);
Varun Wadekar13e7dc42015-12-30 15:15:08 -0800235
Varun Wadekare6d43222016-05-25 16:35:04 -0700236 /*
237 * Lock the configuration settings by disabling TZ-only lock
238 * and locking the configuration against any future changes
239 * at all.
240 */
241 val = tegra_mc_read_32(MC_TZRAM_CARVEOUT_CFG);
Anthony Zhou0844b972017-06-28 16:35:54 +0800242 val &= (uint32_t)~MC_GSC_ENABLE_TZ_LOCK_BIT;
Varun Wadekar153982c2016-12-21 14:50:18 -0800243 val |= MC_GSC_LOCK_CFG_SETTINGS_BIT;
Steven Kaob688d382017-09-06 13:32:21 +0800244 if (!tegra_chipid_is_t186()) {
245 val |= MC_GSC_ENABLE_CPU_SECURE_BIT;
246 }
Varun Wadekare6d43222016-05-25 16:35:04 -0700247 tegra_mc_write_32(MC_TZRAM_CARVEOUT_CFG, val);
Varun Wadekar13e7dc42015-12-30 15:15:08 -0800248
249 /*
Varun Wadekar153982c2016-12-21 14:50:18 -0800250 * MCE propagates the security configuration values across the
Varun Wadekar13e7dc42015-12-30 15:15:08 -0800251 * CCPLEX.
252 */
253 mce_update_gsc_tzram();
254}
255
Varun Wadekar153982c2016-12-21 14:50:18 -0800256static void tegra_lock_videomem_nonoverlap(uint64_t phys_base,
257 uint64_t size_in_bytes)
258{
259 uint32_t index;
260 uint64_t total_128kb_blocks = size_in_bytes >> 17;
261 uint64_t residual_4kb_blocks = (size_in_bytes & (uint32_t)0x1FFFF) >> 12;
262 uint64_t val;
263
264 /*
265 * Reset the access configuration registers to restrict access to
266 * old Videomem aperture
267 */
268 for (index = MC_VIDEO_PROTECT_CLEAR_ACCESS_CFG0;
269 index < ((uint32_t)MC_VIDEO_PROTECT_CLEAR_ACCESS_CFG0 + (uint32_t)MC_GSC_CONFIG_REGS_SIZE);
270 index += 4U) {
271 tegra_mc_write_32(index, 0);
272 }
273
274 /*
275 * Set the base. It must be 4k aligned, at least.
276 */
277 assert((phys_base & (uint64_t)0xFFF) == 0U);
278 tegra_mc_write_32(MC_VIDEO_PROTECT_CLEAR_BASE_LO, (uint32_t)phys_base);
279 tegra_mc_write_32(MC_VIDEO_PROTECT_CLEAR_BASE_HI,
280 (uint32_t)(phys_base >> 32) & (uint32_t)MC_GSC_BASE_HI_MASK);
281
282 /*
283 * Set the aperture size
284 *
285 * total size = (number of 128KB blocks) + (number of remaining 4KB
286 * blocks)
287 *
288 */
289 val = (uint32_t)((residual_4kb_blocks << MC_GSC_SIZE_RANGE_4KB_SHIFT) |
290 total_128kb_blocks);
291 tegra_mc_write_32(MC_VIDEO_PROTECT_CLEAR_SIZE, (uint32_t)val);
292
293 /*
294 * Lock the configuration settings by enabling TZ-only lock and
295 * locking the configuration against any future changes from NS
296 * world.
297 */
298 tegra_mc_write_32(MC_VIDEO_PROTECT_CLEAR_CFG,
299 (uint32_t)MC_GSC_ENABLE_TZ_LOCK_BIT);
300
301 /*
302 * MCE propagates the GSC configuration values across the
303 * CCPLEX.
304 */
305}
306
307static void tegra_unlock_videomem_nonoverlap(void)
308{
309 /* Clear the base */
310 tegra_mc_write_32(MC_VIDEO_PROTECT_CLEAR_BASE_LO, 0);
311 tegra_mc_write_32(MC_VIDEO_PROTECT_CLEAR_BASE_HI, 0);
312
313 /* Clear the size */
314 tegra_mc_write_32(MC_VIDEO_PROTECT_CLEAR_SIZE, 0);
315}
316
317static void tegra_clear_videomem(uintptr_t non_overlap_area_start,
318 unsigned long long non_overlap_area_size)
319{
Varun Wadekar117a2e02017-08-03 11:40:34 -0700320 int ret;
321
Varun Wadekar153982c2016-12-21 14:50:18 -0800322 /*
323 * Map the NS memory first, clean it and then unmap it.
324 */
Varun Wadekar117a2e02017-08-03 11:40:34 -0700325 ret = mmap_add_dynamic_region(non_overlap_area_start, /* PA */
Varun Wadekar153982c2016-12-21 14:50:18 -0800326 non_overlap_area_start, /* VA */
327 non_overlap_area_size, /* size */
328 MT_NS | MT_RW | MT_EXECUTE_NEVER); /* attrs */
Varun Wadekar117a2e02017-08-03 11:40:34 -0700329 assert(ret == 0);
Varun Wadekar153982c2016-12-21 14:50:18 -0800330
331 zero_normalmem((void *)non_overlap_area_start, non_overlap_area_size);
332 flush_dcache_range(non_overlap_area_start, non_overlap_area_size);
333
Anthony Zhou0844b972017-06-28 16:35:54 +0800334 (void)mmap_remove_dynamic_region(non_overlap_area_start,
Varun Wadekar153982c2016-12-21 14:50:18 -0800335 non_overlap_area_size);
336}
337
Varun Wadekar13e7dc42015-12-30 15:15:08 -0800338/*
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530339 * Program the Video Memory carveout region
340 *
341 * phys_base = physical base of aperture
342 * size_in_bytes = size of aperture in bytes
343 */
344void tegra_memctrl_videomem_setup(uint64_t phys_base, uint32_t size_in_bytes)
345{
Varun Wadekar153982c2016-12-21 14:50:18 -0800346 uintptr_t vmem_end_old = video_mem_base + (video_mem_size_mb << 20);
347 uintptr_t vmem_end_new = phys_base + size_in_bytes;
Varun Wadekar153982c2016-12-21 14:50:18 -0800348 unsigned long long non_overlap_area_size;
Varun Wadekare60f1bf2016-02-17 10:10:50 -0800349
350 /*
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530351 * Setup the Memory controller to restrict CPU accesses to the Video
352 * Memory region
353 */
354 INFO("Configuring Video Memory Carveout\n");
355
Varun Wadekar153982c2016-12-21 14:50:18 -0800356 /*
357 * Configure Memory Controller directly for the first time.
358 */
359 if (video_mem_base == 0U)
360 goto done;
361
362 /*
363 * Lock the non overlapping memory being cleared so that other masters
364 * do not accidently write to it. The memory would be unlocked once
365 * the non overlapping region is cleared and the new memory
366 * settings take effect.
367 */
368 tegra_lock_videomem_nonoverlap(video_mem_base,
369 video_mem_size_mb << 20);
370
371 /*
372 * Clear the old regions now being exposed. The following cases
373 * can occur -
374 *
375 * 1. clear whole old region (no overlap with new region)
376 * 2. clear old sub-region below new base
377 * 3. clear old sub-region above new end
378 */
379 INFO("Cleaning previous Video Memory Carveout\n");
380
Anthony Zhou0844b972017-06-28 16:35:54 +0800381 if ((phys_base > vmem_end_old) || (video_mem_base > vmem_end_new)) {
Varun Wadekar153982c2016-12-21 14:50:18 -0800382 tegra_clear_videomem(video_mem_base,
Anthony Zhou0844b972017-06-28 16:35:54 +0800383 (uint32_t)video_mem_size_mb << 20U);
Varun Wadekar153982c2016-12-21 14:50:18 -0800384 } else {
385 if (video_mem_base < phys_base) {
386 non_overlap_area_size = phys_base - video_mem_base;
Anthony Zhou0844b972017-06-28 16:35:54 +0800387 tegra_clear_videomem(video_mem_base,
388 (uint32_t)non_overlap_area_size);
Varun Wadekar153982c2016-12-21 14:50:18 -0800389 }
390 if (vmem_end_old > vmem_end_new) {
391 non_overlap_area_size = vmem_end_old - vmem_end_new;
Anthony Zhou0844b972017-06-28 16:35:54 +0800392 tegra_clear_videomem(vmem_end_new,
393 (uint32_t)non_overlap_area_size);
Varun Wadekar153982c2016-12-21 14:50:18 -0800394 }
395 }
396
397done:
398 /* program the Videomem aperture */
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530399 tegra_mc_write_32(MC_VIDEO_PROTECT_BASE_LO, (uint32_t)phys_base);
400 tegra_mc_write_32(MC_VIDEO_PROTECT_BASE_HI,
401 (uint32_t)(phys_base >> 32));
Varun Wadekar7058aee2016-04-25 09:01:46 -0700402 tegra_mc_write_32(MC_VIDEO_PROTECT_SIZE_MB, size_in_bytes >> 20);
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530403
Varun Wadekar153982c2016-12-21 14:50:18 -0800404 /* unlock the previous locked nonoverlapping aperture */
405 tegra_unlock_videomem_nonoverlap();
406
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530407 /* store new values */
408 video_mem_base = phys_base;
Varun Wadekar7058aee2016-04-25 09:01:46 -0700409 video_mem_size_mb = size_in_bytes >> 20;
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530410
411 /*
Varun Wadekar153982c2016-12-21 14:50:18 -0800412 * MCE propagates the VideoMem configuration values across the
Varun Wadekarcd5a2f52015-09-20 15:08:22 +0530413 * CCPLEX.
414 */
415 mce_update_gsc_videomem();
416}
Varun Wadekarc92050b2017-03-29 14:57:29 -0700417
418/*
419 * This feature exists only for v1 of the Tegra Memory Controller.
420 */
421void tegra_memctrl_disable_ahb_redirection(void)
422{
423 ; /* do nothing */
424}
Harvey Hsieh359be952017-08-21 15:01:53 +0800425
426void tegra_memctrl_clear_pending_interrupts(void)
427{
428 ; /* do nothing */
429}