blob: ce9b1b694b2a1a61e7348d3552b33be64670b9cd [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 *
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 Diaz493bf332016-12-14 14:31:32 +000014 * 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 Xief6118cc2016-01-15 17:17:32 +080018 * 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 Xief6118cc2016-01-15 17:17:32 +080035 * 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 Wang59e41b52016-04-10 14:11:07 +080041#define PSRAM_DT_MPIDR 0x1c
42#define PSRAM_DT_END 0x20
Tony Xief6118cc2016-01-15 17:17:32 +080043/******************************************************************************
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 Xief6118cc2016-01-15 17:17:32 +080053struct psram_data_t {
54 uint64_t sp;
55 uint64_t ddr_func;
56 uint64_t ddr_data;
57 uint32_t ddr_flag;
Tony Xief6118cc2016-01-15 17:17:32 +080058 uint32_t boot_mpidr;
59};
60
61CASSERT(sizeof(struct psram_data_t) <= PSRAM_DT_SIZE,
62 assert_psram_dt_size_mismatch);
63CASSERT(__builtin_offsetof(struct psram_data_t, sp) == PSRAM_DT_SP,
64 assert_psram_dt_sp_offset_mistmatch);
65CASSERT(__builtin_offsetof(struct psram_data_t, ddr_func) == PSRAM_DT_DDR_FUNC,
66 assert_psram_dt_ddr_func_offset_mistmatch);
67CASSERT(__builtin_offsetof(struct psram_data_t, ddr_data) == PSRAM_DT_DDR_DATA,
68 assert_psram_dt_ddr_data_offset_mistmatch);
69CASSERT(__builtin_offsetof(struct psram_data_t, ddr_flag) == PSRAM_DT_DDRFLAG,
70 assert_psram_dt_ddr_flag_offset_mistmatch);
Tony Xief6118cc2016-01-15 17:17:32 +080071CASSERT(__builtin_offsetof(struct psram_data_t, boot_mpidr) == PSRAM_DT_MPIDR,
72 assert_psram_dt_mpidr_offset_mistmatch);
73void u32_align_cpy(uint32_t *dst, const uint32_t *src, size_t bytes);
Caesar Wangd90f43e2016-10-11 09:36:00 +080074
Tony Xief6118cc2016-01-15 17:17:32 +080075#endif /* __ASSEMBLY__ */
76
77#endif