Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are met: |
| 6 | * |
| 7 | * Redistributions of source code must retain the above copyright notice, this |
| 8 | * list of conditions and the following disclaimer. |
| 9 | * |
| 10 | * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer in the documentation |
| 12 | * and/or other materials provided with the distribution. |
| 13 | * |
Antonio Nino Diaz | 493bf33 | 2016-12-14 14:31:32 +0000 | [diff] [blame] | 14 | * Neither the name of ARM nor the names of its contributors may be used |
| 15 | * to endorse or promote products derived from this software without specific |
| 16 | * prior written permission. |
| 17 | * |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | * POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | |
Caesar Wang | d90f43e | 2016-10-11 09:36:00 +0800 | [diff] [blame] | 31 | #include <console.h> |
| 32 | #include <debug.h> |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 33 | #include <platform.h> |
Caesar Wang | d90f43e | 2016-10-11 09:36:00 +0800 | [diff] [blame] | 34 | #include <plat_private.h> |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 35 | |
| 36 | /***************************************************************************** |
| 37 | * sram only surpport 32-bits access |
| 38 | ******************************************************************************/ |
| 39 | void u32_align_cpy(uint32_t *dst, const uint32_t *src, size_t bytes) |
| 40 | { |
| 41 | uint32_t i; |
| 42 | |
| 43 | for (i = 0; i < bytes; i++) |
| 44 | dst[i] = src[i]; |
| 45 | } |
Caesar Wang | d90f43e | 2016-10-11 09:36:00 +0800 | [diff] [blame] | 46 | |
| 47 | void rockchip_plat_sram_mmu_el3(void) |
| 48 | { |
| 49 | #ifdef PLAT_EXTRA_LD_SCRIPT |
| 50 | size_t sram_size; |
| 51 | |
| 52 | /* sram.text size */ |
| 53 | sram_size = (char *)&__bl31_sram_text_end - |
| 54 | (char *)&__bl31_sram_text_start; |
| 55 | mmap_add_region((unsigned long)&__bl31_sram_text_start, |
| 56 | (unsigned long)&__bl31_sram_text_start, |
| 57 | sram_size, MT_MEMORY | MT_RO | MT_SECURE); |
| 58 | |
| 59 | /* sram.data size */ |
| 60 | sram_size = (char *)&__bl31_sram_data_end - |
| 61 | (char *)&__bl31_sram_data_start; |
| 62 | mmap_add_region((unsigned long)&__bl31_sram_data_start, |
| 63 | (unsigned long)&__bl31_sram_data_start, |
| 64 | sram_size, MT_MEMORY | MT_RW | MT_SECURE); |
| 65 | #else |
| 66 | /* TODO: Support other SoCs, Just support RK3399 now */ |
| 67 | return; |
| 68 | #endif |
| 69 | } |
| 70 | |
| 71 | void plat_rockchip_mem_prepare(void) |
| 72 | { |
| 73 | /* The code for resuming cpu from suspend must be excuted in pmusram */ |
| 74 | plat_rockchip_pmusram_prepare(); |
| 75 | } |