Varun Wadekar | 921b906 | 2015-08-25 17:03:14 +0530 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | 4b32e62 | 2018-08-16 16:52:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Varun Wadekar | f3d9b84 | 2018-08-09 15:11:23 -0700 | [diff] [blame] | 3 | * Copyright (c) 2020, NVIDIA Corporation. All rights reserved. |
Varun Wadekar | 921b906 | 2015-08-25 17:03:14 +0530 | [diff] [blame] | 4 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 5 | * SPDX-License-Identifier: BSD-3-Clause |
Varun Wadekar | 921b906 | 2015-08-25 17:03:14 +0530 | [diff] [blame] | 6 | */ |
| 7 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | #include <string.h> |
| 9 | |
Varun Wadekar | 93bed2a | 2016-03-18 13:07:33 -0700 | [diff] [blame] | 10 | #include <arch_helpers.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 11 | #include <common/debug.h> |
| 12 | #include <lib/mmio.h> |
| 13 | |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 14 | #include <mce.h> |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 15 | #include <tegra_def.h> |
Varun Wadekar | 93bed2a | 2016-03-18 13:07:33 -0700 | [diff] [blame] | 16 | #include <tegra_private.h> |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 17 | |
Anthony Zhou | faad346 | 2017-03-21 15:50:09 +0800 | [diff] [blame] | 18 | #define SCRATCH_SECURE_RSV1_SCRATCH_0 0x658U |
| 19 | #define SCRATCH_SECURE_RSV1_SCRATCH_1 0x65CU |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 20 | |
Anthony Zhou | faad346 | 2017-03-21 15:50:09 +0800 | [diff] [blame] | 21 | #define CPU_RESET_MODE_AA64 1U |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 22 | |
Varun Wadekar | 921b906 | 2015-08-25 17:03:14 +0530 | [diff] [blame] | 23 | /******************************************************************************* |
| 24 | * Setup secondary CPU vectors |
| 25 | ******************************************************************************/ |
| 26 | void plat_secondary_setup(void) |
| 27 | { |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 28 | uint32_t addr_low, addr_high; |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 29 | |
| 30 | INFO("Setting up secondary CPU boot\n"); |
| 31 | |
Varun Wadekar | 8304fc8 | 2017-10-25 11:52:07 -0700 | [diff] [blame] | 32 | /* TZDRAM base will be used as the "resume" address */ |
Varun Wadekar | 17ad11a | 2018-11-09 09:08:16 -0800 | [diff] [blame] | 33 | addr_low = (uintptr_t)&tegra_secure_entrypoint | CPU_RESET_MODE_AA64; |
| 34 | addr_high = (uintptr_t)(((uintptr_t)&tegra_secure_entrypoint >> 32U) & 0x7ffU); |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 35 | |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 36 | /* save reset vector to be used during SYSTEM_SUSPEND exit */ |
Steven Kao | 186485e | 2017-10-23 18:22:09 +0800 | [diff] [blame] | 37 | mmio_write_32(TEGRA_SCRATCH_BASE + SCRATCH_RESET_VECTOR_LO, |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 38 | addr_low); |
Steven Kao | 186485e | 2017-10-23 18:22:09 +0800 | [diff] [blame] | 39 | mmio_write_32(TEGRA_SCRATCH_BASE + SCRATCH_RESET_VECTOR_HI, |
Varun Wadekar | abd153c | 2015-09-14 09:31:39 +0530 | [diff] [blame] | 40 | addr_high); |
Varun Wadekar | 921b906 | 2015-08-25 17:03:14 +0530 | [diff] [blame] | 41 | } |