Antonio Nino Diaz | 493bf33 | 2016-12-14 14:31:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 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 | |
| 31 | #ifndef __PMU_SRAM_H__ |
| 32 | #define __PMU_SRAM_H__ |
| 33 | |
| 34 | /***************************************************************************** |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 35 | * define data offset in struct psram_data |
| 36 | *****************************************************************************/ |
| 37 | #define PSRAM_DT_SP 0x0 |
| 38 | #define PSRAM_DT_DDR_FUNC 0x8 |
| 39 | #define PSRAM_DT_DDR_DATA 0x10 |
| 40 | #define PSRAM_DT_DDRFLAG 0x18 |
Caesar Wang | 59e41b5 | 2016-04-10 14:11:07 +0800 | [diff] [blame] | 41 | #define PSRAM_DT_MPIDR 0x1c |
| 42 | #define PSRAM_DT_END 0x20 |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 43 | /****************************************************************************** |
| 44 | * Allocate data region for struct psram_data_t in pmusram |
| 45 | ******************************************************************************/ |
| 46 | /* Needed aligned 16 bytes for sp stack top */ |
| 47 | #define PSRAM_DT_SIZE (((PSRAM_DT_END + 16) / 16) * 16) |
| 48 | #define PSRAM_DT_BASE ((PMUSRAM_BASE + PMUSRAM_RSIZE) - PSRAM_DT_SIZE) |
| 49 | #define PSRAM_SP_TOP PSRAM_DT_BASE |
| 50 | |
| 51 | #ifndef __ASSEMBLY__ |
| 52 | |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 53 | struct psram_data_t { |
| 54 | uint64_t sp; |
| 55 | uint64_t ddr_func; |
| 56 | uint64_t ddr_data; |
| 57 | uint32_t ddr_flag; |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 58 | uint32_t boot_mpidr; |
| 59 | }; |
| 60 | |
| 61 | CASSERT(sizeof(struct psram_data_t) <= PSRAM_DT_SIZE, |
| 62 | assert_psram_dt_size_mismatch); |
| 63 | CASSERT(__builtin_offsetof(struct psram_data_t, sp) == PSRAM_DT_SP, |
| 64 | assert_psram_dt_sp_offset_mistmatch); |
| 65 | CASSERT(__builtin_offsetof(struct psram_data_t, ddr_func) == PSRAM_DT_DDR_FUNC, |
| 66 | assert_psram_dt_ddr_func_offset_mistmatch); |
| 67 | CASSERT(__builtin_offsetof(struct psram_data_t, ddr_data) == PSRAM_DT_DDR_DATA, |
| 68 | assert_psram_dt_ddr_data_offset_mistmatch); |
| 69 | CASSERT(__builtin_offsetof(struct psram_data_t, ddr_flag) == PSRAM_DT_DDRFLAG, |
| 70 | assert_psram_dt_ddr_flag_offset_mistmatch); |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 71 | CASSERT(__builtin_offsetof(struct psram_data_t, boot_mpidr) == PSRAM_DT_MPIDR, |
| 72 | assert_psram_dt_mpidr_offset_mistmatch); |
| 73 | void u32_align_cpy(uint32_t *dst, const uint32_t *src, size_t bytes); |
Caesar Wang | d90f43e | 2016-10-11 09:36:00 +0800 | [diff] [blame] | 74 | |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 75 | #endif /* __ASSEMBLY__ */ |
| 76 | |
| 77 | #endif |