xref: /rk3399_ARM-atf/plat/rockchip/common/drivers/parameter/ddr_parameter.h (revision 0d5ec955b8f7900ca33abf88638d499742531159)
1*0d5ec955Stony.xie /*
2*0d5ec955Stony.xie  * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3*0d5ec955Stony.xie  *
4*0d5ec955Stony.xie  * Redistribution and use in source and binary forms, with or without
5*0d5ec955Stony.xie  * modification, are permitted provided that the following conditions are met:
6*0d5ec955Stony.xie  *
7*0d5ec955Stony.xie  * Redistributions of source code must retain the above copyright notice, this
8*0d5ec955Stony.xie  * list of conditions and the following disclaimer.
9*0d5ec955Stony.xie  *
10*0d5ec955Stony.xie  * Redistributions in binary form must reproduce the above copyright notice,
11*0d5ec955Stony.xie  * this list of conditions and the following disclaimer in the documentation
12*0d5ec955Stony.xie  * and/or other materials provided with the distribution.
13*0d5ec955Stony.xie  *
14*0d5ec955Stony.xie  * Neither the name of ARM nor the names of its contributors may be used
15*0d5ec955Stony.xie  * to endorse or promote products derived from this software without specific
16*0d5ec955Stony.xie  * prior written permission.
17*0d5ec955Stony.xie  *
18*0d5ec955Stony.xie  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19*0d5ec955Stony.xie  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20*0d5ec955Stony.xie  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21*0d5ec955Stony.xie  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22*0d5ec955Stony.xie  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*0d5ec955Stony.xie  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*0d5ec955Stony.xie  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25*0d5ec955Stony.xie  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26*0d5ec955Stony.xie  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27*0d5ec955Stony.xie  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*0d5ec955Stony.xie  * POSSIBILITY OF SUCH DAMAGE.
29*0d5ec955Stony.xie  */
30*0d5ec955Stony.xie 
31*0d5ec955Stony.xie #ifndef __PARAMETER_H__
32*0d5ec955Stony.xie #define __PARAMETER_H__
33*0d5ec955Stony.xie 
34*0d5ec955Stony.xie #include <arch_helpers.h>
35*0d5ec955Stony.xie #include <console.h>
36*0d5ec955Stony.xie #include <debug.h>
37*0d5ec955Stony.xie #include <delay_timer.h>
38*0d5ec955Stony.xie #include <mmio.h>
39*0d5ec955Stony.xie #include <platform_def.h>
40*0d5ec955Stony.xie #include <plat_private.h>
41*0d5ec955Stony.xie #include <soc.h>
42*0d5ec955Stony.xie #include <string.h>
43*0d5ec955Stony.xie 
44*0d5ec955Stony.xie #define DDR_REGION_NR_MAX		10
45*0d5ec955Stony.xie #define REGION_NR_OFFSET		0
46*0d5ec955Stony.xie #define REGION_ADDR_OFFSET		8
47*0d5ec955Stony.xie #define REGION_DATA_PER_BYTES		8
48*0d5ec955Stony.xie #define RG_SIZE_MB(byte)		((byte) >> 20)
49*0d5ec955Stony.xie 
50*0d5ec955Stony.xie /* unit: MB */
51*0d5ec955Stony.xie struct param_ddr_usage {
52*0d5ec955Stony.xie 	uint64_t boundary;
53*0d5ec955Stony.xie 
54*0d5ec955Stony.xie 	uint32_t ns_nr;
55*0d5ec955Stony.xie 	uint64_t ns_base[DDR_REGION_NR_MAX];
56*0d5ec955Stony.xie 	uint64_t ns_top[DDR_REGION_NR_MAX];
57*0d5ec955Stony.xie 
58*0d5ec955Stony.xie 	uint32_t s_nr;
59*0d5ec955Stony.xie 	uint64_t s_base[DDR_REGION_NR_MAX];
60*0d5ec955Stony.xie 	uint64_t s_top[DDR_REGION_NR_MAX];
61*0d5ec955Stony.xie };
62*0d5ec955Stony.xie 
63*0d5ec955Stony.xie struct param_ddr_usage ddr_region_usage_parse(uint64_t addr, uint64_t max_mb);
64*0d5ec955Stony.xie 
65*0d5ec955Stony.xie #endif /* __PARAMETER_H__ */
66