Sheetal Tigadoli | 13680c9 | 2019-12-13 10:39:06 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019-2020, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <assert.h> |
| 8 | |
| 9 | #include <arch.h> |
| 10 | #include <arch_helpers.h> |
| 11 | #include <common/debug.h> |
| 12 | #include <plat/common/platform.h> |
| 13 | |
| 14 | #include <plat_brcm.h> |
| 15 | #include <platform_def.h> |
| 16 | |
| 17 | /* Weak definitions may be overridden in specific BRCM platform */ |
| 18 | #pragma weak plat_get_ns_image_entrypoint |
| 19 | #pragma weak plat_brcm_get_mmap |
| 20 | |
| 21 | uintptr_t plat_get_ns_image_entrypoint(void) |
| 22 | { |
| 23 | #ifdef PRELOADED_BL33_BASE |
| 24 | return PRELOADED_BL33_BASE; |
| 25 | #else |
| 26 | return PLAT_BRCM_NS_IMAGE_OFFSET; |
| 27 | #endif |
| 28 | } |
| 29 | |
| 30 | uint32_t brcm_get_spsr_for_bl32_entry(void) |
| 31 | { |
| 32 | /* |
| 33 | * The Secure Payload Dispatcher service is responsible for |
| 34 | * setting the SPSR prior to entry into the BL32 image. |
| 35 | */ |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | uint32_t brcm_get_spsr_for_bl33_entry(void) |
| 40 | { |
| 41 | unsigned int mode; |
| 42 | uint32_t spsr; |
| 43 | |
| 44 | /* Figure out what mode we enter the non-secure world in */ |
| 45 | mode = el_implemented(2) ? MODE_EL2 : MODE_EL1; |
| 46 | |
| 47 | /* |
| 48 | * TODO: Consider the possibility of specifying the SPSR in |
| 49 | * the FIP ToC and allowing the platform to have a say as |
| 50 | * well. |
| 51 | */ |
| 52 | spsr = SPSR_64(mode, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS); |
| 53 | return spsr; |
| 54 | } |
| 55 | |
| 56 | const mmap_region_t *plat_brcm_get_mmap(void) |
| 57 | { |
| 58 | return plat_brcm_mmap; |
| 59 | } |