blob: fbb550af9621a40c7c1921f5cc376313889f3671 [file] [log] [blame]
Varun Wadekar921b9062015-08-25 17:03:14 +05301/*
Antonio Nino Diaz4b32e622018-08-16 16:52:57 +01002 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
Varun Wadekarf3d9b842018-08-09 15:11:23 -07003 * Copyright (c) 2020, NVIDIA Corporation. All rights reserved.
Varun Wadekar921b9062015-08-25 17:03:14 +05304 *
dp-armfa3cf0b2017-05-03 09:38:09 +01005 * SPDX-License-Identifier: BSD-3-Clause
Varun Wadekar921b9062015-08-25 17:03:14 +05306 */
7
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008#include <string.h>
9
Varun Wadekar93bed2a2016-03-18 13:07:33 -070010#include <arch_helpers.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000011#include <common/debug.h>
12#include <lib/mmio.h>
13
Varun Wadekarabd153c2015-09-14 09:31:39 +053014#include <mce.h>
Varun Wadekarabd153c2015-09-14 09:31:39 +053015#include <tegra_def.h>
Varun Wadekar93bed2a2016-03-18 13:07:33 -070016#include <tegra_private.h>
Varun Wadekarabd153c2015-09-14 09:31:39 +053017
Anthony Zhoufaad3462017-03-21 15:50:09 +080018#define SCRATCH_SECURE_RSV1_SCRATCH_0 0x658U
19#define SCRATCH_SECURE_RSV1_SCRATCH_1 0x65CU
Varun Wadekarabd153c2015-09-14 09:31:39 +053020
Anthony Zhoufaad3462017-03-21 15:50:09 +080021#define CPU_RESET_MODE_AA64 1U
Varun Wadekarabd153c2015-09-14 09:31:39 +053022
Varun Wadekar921b9062015-08-25 17:03:14 +053023/*******************************************************************************
24 * Setup secondary CPU vectors
25 ******************************************************************************/
26void plat_secondary_setup(void)
27{
Varun Wadekarabd153c2015-09-14 09:31:39 +053028 uint32_t addr_low, addr_high;
Varun Wadekarabd153c2015-09-14 09:31:39 +053029
30 INFO("Setting up secondary CPU boot\n");
31
Varun Wadekar8304fc82017-10-25 11:52:07 -070032 /* TZDRAM base will be used as the "resume" address */
Varun Wadekar17ad11a2018-11-09 09:08:16 -080033 addr_low = (uintptr_t)&tegra_secure_entrypoint | CPU_RESET_MODE_AA64;
34 addr_high = (uintptr_t)(((uintptr_t)&tegra_secure_entrypoint >> 32U) & 0x7ffU);
Varun Wadekarabd153c2015-09-14 09:31:39 +053035
Varun Wadekarabd153c2015-09-14 09:31:39 +053036 /* save reset vector to be used during SYSTEM_SUSPEND exit */
Steven Kao186485e2017-10-23 18:22:09 +080037 mmio_write_32(TEGRA_SCRATCH_BASE + SCRATCH_RESET_VECTOR_LO,
Varun Wadekarabd153c2015-09-14 09:31:39 +053038 addr_low);
Steven Kao186485e2017-10-23 18:22:09 +080039 mmio_write_32(TEGRA_SCRATCH_BASE + SCRATCH_RESET_VECTOR_HI,
Varun Wadekarabd153c2015-09-14 09:31:39 +053040 addr_high);
Varun Wadekar921b9062015-08-25 17:03:14 +053041}