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 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __PMU_SRAM_H__ |
| 8 | #define __PMU_SRAM_H__ |
| 9 | |
| 10 | /***************************************************************************** |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 11 | * define data offset in struct psram_data |
| 12 | *****************************************************************************/ |
| 13 | #define PSRAM_DT_SP 0x0 |
| 14 | #define PSRAM_DT_DDR_FUNC 0x8 |
| 15 | #define PSRAM_DT_DDR_DATA 0x10 |
| 16 | #define PSRAM_DT_DDRFLAG 0x18 |
Caesar Wang | 59e41b5 | 2016-04-10 14:11:07 +0800 | [diff] [blame] | 17 | #define PSRAM_DT_MPIDR 0x1c |
| 18 | #define PSRAM_DT_END 0x20 |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 19 | /****************************************************************************** |
| 20 | * Allocate data region for struct psram_data_t in pmusram |
| 21 | ******************************************************************************/ |
| 22 | /* Needed aligned 16 bytes for sp stack top */ |
| 23 | #define PSRAM_DT_SIZE (((PSRAM_DT_END + 16) / 16) * 16) |
| 24 | #define PSRAM_DT_BASE ((PMUSRAM_BASE + PMUSRAM_RSIZE) - PSRAM_DT_SIZE) |
| 25 | #define PSRAM_SP_TOP PSRAM_DT_BASE |
| 26 | |
| 27 | #ifndef __ASSEMBLY__ |
| 28 | |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 29 | struct psram_data_t { |
| 30 | uint64_t sp; |
| 31 | uint64_t ddr_func; |
| 32 | uint64_t ddr_data; |
| 33 | uint32_t ddr_flag; |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 34 | uint32_t boot_mpidr; |
| 35 | }; |
| 36 | |
| 37 | CASSERT(sizeof(struct psram_data_t) <= PSRAM_DT_SIZE, |
| 38 | assert_psram_dt_size_mismatch); |
| 39 | CASSERT(__builtin_offsetof(struct psram_data_t, sp) == PSRAM_DT_SP, |
| 40 | assert_psram_dt_sp_offset_mistmatch); |
| 41 | CASSERT(__builtin_offsetof(struct psram_data_t, ddr_func) == PSRAM_DT_DDR_FUNC, |
| 42 | assert_psram_dt_ddr_func_offset_mistmatch); |
| 43 | CASSERT(__builtin_offsetof(struct psram_data_t, ddr_data) == PSRAM_DT_DDR_DATA, |
| 44 | assert_psram_dt_ddr_data_offset_mistmatch); |
| 45 | CASSERT(__builtin_offsetof(struct psram_data_t, ddr_flag) == PSRAM_DT_DDRFLAG, |
| 46 | assert_psram_dt_ddr_flag_offset_mistmatch); |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 47 | CASSERT(__builtin_offsetof(struct psram_data_t, boot_mpidr) == PSRAM_DT_MPIDR, |
| 48 | assert_psram_dt_mpidr_offset_mistmatch); |
| 49 | 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] | 50 | |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 51 | #endif /* __ASSEMBLY__ */ |
| 52 | |
| 53 | #endif |