Commit 9171ced3 authored by Yann Gautier's avatar Yann Gautier
Browse files

plat/hisilicon: do not keep mmc_device_info in stack

Create a dedicated static struct mmc_device_info mmc_info mmc_info
instead of having this in stack.
A boot issue has been seen on some platform when applying patch [1].

 [1] 13f3c516

 ("mmc:prevent accessing to the released space in case of wrong usage")
Signed-off-by: default avatarYann Gautier <yann.gautier@foss.st.com>
Change-Id: If5db8857cccec2e677b16a38eb3eeb41628a264c
parent 4ecd2417
/* /*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
/* Data structure which holds the extents of the trusted RAM for BL1 */ /* Data structure which holds the extents of the trusted RAM for BL1 */
static meminfo_t bl1_tzram_layout; static meminfo_t bl1_tzram_layout;
static console_t console; static console_t console;
static struct mmc_device_info mmc_info;
enum { enum {
BOOT_NORMAL = 0, BOOT_NORMAL = 0,
...@@ -78,7 +79,6 @@ void bl1_plat_arch_setup(void) ...@@ -78,7 +79,6 @@ void bl1_plat_arch_setup(void)
void bl1_platform_setup(void) void bl1_platform_setup(void)
{ {
dw_mmc_params_t params; dw_mmc_params_t params;
struct mmc_device_info info;
assert((HIKEY_BL1_MMC_DESC_BASE >= SRAM_BASE) && assert((HIKEY_BL1_MMC_DESC_BASE >= SRAM_BASE) &&
((SRAM_BASE + SRAM_SIZE) >= ((SRAM_BASE + SRAM_SIZE) >=
...@@ -99,8 +99,8 @@ void bl1_platform_setup(void) ...@@ -99,8 +99,8 @@ void bl1_platform_setup(void)
params.clk_rate = 24 * 1000 * 1000; params.clk_rate = 24 * 1000 * 1000;
params.bus_width = MMC_BUS_WIDTH_8; params.bus_width = MMC_BUS_WIDTH_8;
params.flags = MMC_FLAG_CMD23; params.flags = MMC_FLAG_CMD23;
info.mmc_dev_type = MMC_IS_EMMC; mmc_info.mmc_dev_type = MMC_IS_EMMC;
dw_mmc_init(&params, &info); dw_mmc_init(&params, &mmc_info);
hikey_io_setup(); hikey_io_setup();
} }
......
/* /*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
static meminfo_t bl2_el3_tzram_layout; static meminfo_t bl2_el3_tzram_layout;
static console_t console; static console_t console;
static struct mmc_device_info mmc_info;
enum { enum {
BOOT_MODE_RECOVERY = 0, BOOT_MODE_RECOVERY = 0,
...@@ -290,7 +291,6 @@ void bl2_el3_plat_arch_setup(void) ...@@ -290,7 +291,6 @@ void bl2_el3_plat_arch_setup(void)
void bl2_platform_setup(void) void bl2_platform_setup(void)
{ {
dw_mmc_params_t params; dw_mmc_params_t params;
struct mmc_device_info info;
hikey_sp804_init(); hikey_sp804_init();
hikey_gpio_init(); hikey_gpio_init();
...@@ -322,8 +322,8 @@ void bl2_platform_setup(void) ...@@ -322,8 +322,8 @@ void bl2_platform_setup(void)
params.clk_rate = 24 * 1000 * 1000; params.clk_rate = 24 * 1000 * 1000;
params.bus_width = MMC_BUS_WIDTH_8; params.bus_width = MMC_BUS_WIDTH_8;
params.flags = MMC_FLAG_CMD23; params.flags = MMC_FLAG_CMD23;
info.mmc_dev_type = MMC_IS_EMMC; mmc_info.mmc_dev_type = MMC_IS_EMMC;
dw_mmc_init(&params, &info); dw_mmc_init(&params, &mmc_info);
hikey_io_setup(); hikey_io_setup();
} }
/* /*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -30,6 +30,10 @@ static meminfo_t bl1_tzram_layout; ...@@ -30,6 +30,10 @@ static meminfo_t bl1_tzram_layout;
static meminfo_t bl2_tzram_layout; static meminfo_t bl2_tzram_layout;
static console_t console; static console_t console;
#if !POPLAR_RECOVERY
static struct mmc_device_info mmc_info;
#endif
/* /*
* Cannot use default weak implementation in bl1_main.c because BL1 RW data is * Cannot use default weak implementation in bl1_main.c because BL1 RW data is
* not at the top of the secure memory. * not at the top of the secure memory.
...@@ -90,7 +94,6 @@ void bl1_platform_setup(void) ...@@ -90,7 +94,6 @@ void bl1_platform_setup(void)
{ {
int i; int i;
#if !POPLAR_RECOVERY #if !POPLAR_RECOVERY
struct mmc_device_info info;
dw_mmc_params_t params = EMMC_INIT_PARAMS(POPLAR_EMMC_DESC_BASE); dw_mmc_params_t params = EMMC_INIT_PARAMS(POPLAR_EMMC_DESC_BASE);
#endif #endif
...@@ -103,8 +106,8 @@ void bl1_platform_setup(void) ...@@ -103,8 +106,8 @@ void bl1_platform_setup(void)
#if !POPLAR_RECOVERY #if !POPLAR_RECOVERY
/* SoC-specific emmc register are initialized/configured by bootrom */ /* SoC-specific emmc register are initialized/configured by bootrom */
INFO("BL1: initializing emmc\n"); INFO("BL1: initializing emmc\n");
info.mmc_dev_type = MMC_IS_EMMC; mmc_info.mmc_dev_type = MMC_IS_EMMC;
dw_mmc_init(&params, &info); dw_mmc_init(&params, &mmc_info);
#endif #endif
plat_io_setup(); plat_io_setup();
......
/* /*
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE); static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE);
static console_t console; static console_t console;
#if !POPLAR_RECOVERY
static struct mmc_device_info mmc_info;
#endif
/******************************************************************************* /*******************************************************************************
* Transfer SCP_BL2 from Trusted RAM using the SCP Download protocol. * Transfer SCP_BL2 from Trusted RAM using the SCP Download protocol.
...@@ -171,8 +174,6 @@ void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, ...@@ -171,8 +174,6 @@ void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
{ {
struct meminfo *mem_layout = (struct meminfo *)arg1; struct meminfo *mem_layout = (struct meminfo *)arg1;
#if !POPLAR_RECOVERY #if !POPLAR_RECOVERY
struct mmc_device_info info;
dw_mmc_params_t params = EMMC_INIT_PARAMS(POPLAR_EMMC_DESC_BASE); dw_mmc_params_t params = EMMC_INIT_PARAMS(POPLAR_EMMC_DESC_BASE);
#endif #endif
...@@ -187,8 +188,8 @@ void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, ...@@ -187,8 +188,8 @@ void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
#if !POPLAR_RECOVERY #if !POPLAR_RECOVERY
/* SoC-specific emmc register are initialized/configured by bootrom */ /* SoC-specific emmc register are initialized/configured by bootrom */
INFO("BL2: initializing emmc\n"); INFO("BL2: initializing emmc\n");
info.mmc_dev_type = MMC_IS_EMMC; mmc_info.mmc_dev_type = MMC_IS_EMMC;
dw_mmc_init(&params, &info); dw_mmc_init(&params, &mmc_info);
#endif #endif
plat_io_setup(); plat_io_setup();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment