Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 1 | /* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. |
| 2 | * |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions are met: |
| 5 | * |
| 6 | * Redistributions of source code must retain the above copyright notice, this |
| 7 | * list of conditions and the following disclaimer. |
| 8 | * |
| 9 | * Redistributions in binary form must reproduce the above copyright notice, |
| 10 | * this list of conditions and the following disclaimer in the documentation |
| 11 | * and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 16 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 17 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 23 | * POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #ifndef __PMU_SRAM_H__ |
| 27 | #define __PMU_SRAM_H__ |
| 28 | |
| 29 | /***************************************************************************** |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 30 | * define data offset in struct psram_data |
| 31 | *****************************************************************************/ |
| 32 | #define PSRAM_DT_SP 0x0 |
| 33 | #define PSRAM_DT_DDR_FUNC 0x8 |
| 34 | #define PSRAM_DT_DDR_DATA 0x10 |
| 35 | #define PSRAM_DT_DDRFLAG 0x18 |
Caesar Wang | 59e41b5 | 2016-04-10 14:11:07 +0800 | [diff] [blame] | 36 | #define PSRAM_DT_MPIDR 0x1c |
| 37 | #define PSRAM_DT_END 0x20 |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 38 | /****************************************************************************** |
| 39 | * Allocate data region for struct psram_data_t in pmusram |
| 40 | ******************************************************************************/ |
| 41 | /* Needed aligned 16 bytes for sp stack top */ |
| 42 | #define PSRAM_DT_SIZE (((PSRAM_DT_END + 16) / 16) * 16) |
| 43 | #define PSRAM_DT_BASE ((PMUSRAM_BASE + PMUSRAM_RSIZE) - PSRAM_DT_SIZE) |
| 44 | #define PSRAM_SP_TOP PSRAM_DT_BASE |
| 45 | |
| 46 | #ifndef __ASSEMBLY__ |
| 47 | |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 48 | struct psram_data_t { |
| 49 | uint64_t sp; |
| 50 | uint64_t ddr_func; |
| 51 | uint64_t ddr_data; |
| 52 | uint32_t ddr_flag; |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 53 | uint32_t boot_mpidr; |
| 54 | }; |
| 55 | |
| 56 | CASSERT(sizeof(struct psram_data_t) <= PSRAM_DT_SIZE, |
| 57 | assert_psram_dt_size_mismatch); |
| 58 | CASSERT(__builtin_offsetof(struct psram_data_t, sp) == PSRAM_DT_SP, |
| 59 | assert_psram_dt_sp_offset_mistmatch); |
| 60 | CASSERT(__builtin_offsetof(struct psram_data_t, ddr_func) == PSRAM_DT_DDR_FUNC, |
| 61 | assert_psram_dt_ddr_func_offset_mistmatch); |
| 62 | CASSERT(__builtin_offsetof(struct psram_data_t, ddr_data) == PSRAM_DT_DDR_DATA, |
| 63 | assert_psram_dt_ddr_data_offset_mistmatch); |
| 64 | CASSERT(__builtin_offsetof(struct psram_data_t, ddr_flag) == PSRAM_DT_DDRFLAG, |
| 65 | assert_psram_dt_ddr_flag_offset_mistmatch); |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 66 | CASSERT(__builtin_offsetof(struct psram_data_t, boot_mpidr) == PSRAM_DT_MPIDR, |
| 67 | assert_psram_dt_mpidr_offset_mistmatch); |
| 68 | 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] | 69 | |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 70 | #endif /* __ASSEMBLY__ */ |
| 71 | |
| 72 | #endif |