1 /*
2  * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef DDR_PARAMETER_H
8 #define DDR_PARAMETER_H
9 
10 #include <string.h>
11 
12 #include <platform_def.h>
13 
14 #include <arch_helpers.h>
15 #include <common/debug.h>
16 #include <drivers/console.h>
17 #include <drivers/delay_timer.h>
18 #include <lib/mmio.h>
19 
20 #include <plat_private.h>
21 #include <soc.h>
22 
23 #define DDR_REGION_NR_MAX		10
24 #define REGION_NR_OFFSET		0
25 #define REGION_ADDR_OFFSET		8
26 #define REGION_DATA_PER_BYTES		8
27 #define RG_SIZE_MB(byte)		((byte) >> 20)
28 
29 /* unit: MB */
30 struct param_ddr_usage {
31 	uint64_t boundary;
32 
33 	uint32_t ns_nr;
34 	uint64_t ns_base[DDR_REGION_NR_MAX];
35 	uint64_t ns_top[DDR_REGION_NR_MAX];
36 
37 	uint32_t s_nr;
38 	uint64_t s_base[DDR_REGION_NR_MAX + 1];
39 	uint64_t s_top[DDR_REGION_NR_MAX + 1];
40 };
41 
42 struct param_ddr_usage ddr_region_usage_parse(uint64_t addr, uint64_t max_mb);
43 
44 #endif /* DDR_PARAMETER_H */
45