blob: 24a1c25e8e6bd3af67ed342a9c9fa236ed6d3cec [file] [log] [blame]
Antonio Nino Diaz493bf332016-12-14 14:31:32 +00001/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
Tony Xief6118cc2016-01-15 17:17:32 +08003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Tony Xief6118cc2016-01-15 17:17:32 +08005 */
6
7#ifndef __PMU_SRAM_H__
8#define __PMU_SRAM_H__
9
10/*****************************************************************************
Tony Xief6118cc2016-01-15 17:17:32 +080011 * 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 Wang59e41b52016-04-10 14:11:07 +080017#define PSRAM_DT_MPIDR 0x1c
18#define PSRAM_DT_END 0x20
Tony Xief6118cc2016-01-15 17:17:32 +080019/******************************************************************************
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 Xief6118cc2016-01-15 17:17:32 +080029struct psram_data_t {
30 uint64_t sp;
31 uint64_t ddr_func;
32 uint64_t ddr_data;
33 uint32_t ddr_flag;
Tony Xief6118cc2016-01-15 17:17:32 +080034 uint32_t boot_mpidr;
35};
36
37CASSERT(sizeof(struct psram_data_t) <= PSRAM_DT_SIZE,
38 assert_psram_dt_size_mismatch);
39CASSERT(__builtin_offsetof(struct psram_data_t, sp) == PSRAM_DT_SP,
40 assert_psram_dt_sp_offset_mistmatch);
41CASSERT(__builtin_offsetof(struct psram_data_t, ddr_func) == PSRAM_DT_DDR_FUNC,
42 assert_psram_dt_ddr_func_offset_mistmatch);
43CASSERT(__builtin_offsetof(struct psram_data_t, ddr_data) == PSRAM_DT_DDR_DATA,
44 assert_psram_dt_ddr_data_offset_mistmatch);
45CASSERT(__builtin_offsetof(struct psram_data_t, ddr_flag) == PSRAM_DT_DDRFLAG,
46 assert_psram_dt_ddr_flag_offset_mistmatch);
Tony Xief6118cc2016-01-15 17:17:32 +080047CASSERT(__builtin_offsetof(struct psram_data_t, boot_mpidr) == PSRAM_DT_MPIDR,
48 assert_psram_dt_mpidr_offset_mistmatch);
49void u32_align_cpy(uint32_t *dst, const uint32_t *src, size_t bytes);
Caesar Wangd90f43e2016-10-11 09:36:00 +080050
Tony Xief6118cc2016-01-15 17:17:32 +080051#endif /* __ASSEMBLY__ */
52
53#endif