From b729699288b621ee77bfe27bea1273961c0f4998 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=99=88=E4=BA=AE?= Date: Wed, 30 Jul 2014 18:58:07 -0700 Subject: [PATCH] rk312x: add pie init MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: 陈亮 --- arch/arm/mach-rockchip/rk312x.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/rk312x.c b/arch/arm/mach-rockchip/rk312x.c index c2be5b7813e7..b6473e34eff9 100755 --- a/arch/arm/mach-rockchip/rk312x.c +++ b/arch/arm/mach-rockchip/rk312x.c @@ -36,7 +36,7 @@ #include #include "cpu_axi.h" #include "loader.h" -#define CPU 312X +#define CPU 312x #include "sram.h" #include "pm.h" @@ -146,3 +146,33 @@ DT_MACHINE_START(RK3128_DT, "Rockchip RK3128") .reserve = rk312x_reserve, .restart = rk312x_restart, MACHINE_END + + +char PIE_DATA(sram_stack)[1024]; +EXPORT_PIE_SYMBOL(DATA(sram_stack)); + +static int __init rk312x_pie_init(void) +{ + int err; + + if (!cpu_is_rk312x()) + return 0; + + err = rockchip_pie_init(); + if (err) + return err; + + rockchip_pie_chunk = pie_load_sections(rockchip_sram_pool, rk312x); + if (IS_ERR(rockchip_pie_chunk)) { + err = PTR_ERR(rockchip_pie_chunk); + pr_err("%s: failed to load section %d\n", __func__, err); + rockchip_pie_chunk = NULL; + return err; + } + + rockchip_sram_virt = kern_to_pie(rockchip_pie_chunk, &__pie_common_start[0]); + rockchip_sram_stack = kern_to_pie(rockchip_pie_chunk, (char *)DATA(sram_stack) + sizeof(DATA(sram_stack))); + + return 0; +} +arch_initcall(rk312x_pie_init); -- 2.34.1