blob: f29046123989ea8f90a6a41e4db8537c7cdce8c1 [file] [log] [blame]
Tony Xief6118cc2016-01-15 17:17:32 +08001/* 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 Xief6118cc2016-01-15 17:17:32 +080030 * 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 Wang59e41b52016-04-10 14:11:07 +080036#define PSRAM_DT_MPIDR 0x1c
37#define PSRAM_DT_END 0x20
Tony Xief6118cc2016-01-15 17:17:32 +080038/******************************************************************************
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
48/*
49 * The struct is used in pmu_cpus_on.S which
50 * gets the data of the struct by the following index
51 * #define PSRAM_DT_SP 0x0
52 * #define PSRAM_DT_DDR_FUNC 0x8
53 * #define PSRAM_DT_DDR_DATA 0x10
54 * #define PSRAM_DT_DDRFLAG 0x18
55 * #define PSRAM_DT_SYS_MODE 0x1c
56 * #define PSRAM_DT_MPIDR 0x20
57 */
58struct psram_data_t {
59 uint64_t sp;
60 uint64_t ddr_func;
61 uint64_t ddr_data;
62 uint32_t ddr_flag;
Tony Xief6118cc2016-01-15 17:17:32 +080063 uint32_t boot_mpidr;
64};
65
66CASSERT(sizeof(struct psram_data_t) <= PSRAM_DT_SIZE,
67 assert_psram_dt_size_mismatch);
68CASSERT(__builtin_offsetof(struct psram_data_t, sp) == PSRAM_DT_SP,
69 assert_psram_dt_sp_offset_mistmatch);
70CASSERT(__builtin_offsetof(struct psram_data_t, ddr_func) == PSRAM_DT_DDR_FUNC,
71 assert_psram_dt_ddr_func_offset_mistmatch);
72CASSERT(__builtin_offsetof(struct psram_data_t, ddr_data) == PSRAM_DT_DDR_DATA,
73 assert_psram_dt_ddr_data_offset_mistmatch);
74CASSERT(__builtin_offsetof(struct psram_data_t, ddr_flag) == PSRAM_DT_DDRFLAG,
75 assert_psram_dt_ddr_flag_offset_mistmatch);
Tony Xief6118cc2016-01-15 17:17:32 +080076CASSERT(__builtin_offsetof(struct psram_data_t, boot_mpidr) == PSRAM_DT_MPIDR,
77 assert_psram_dt_mpidr_offset_mistmatch);
78void u32_align_cpy(uint32_t *dst, const uint32_t *src, size_t bytes);
79#endif /* __ASSEMBLY__ */
80
81#endif