arc: start mpu in prep_c, do not use SYS_INIT
Initialize MPU in prep_c similar to how all other architectures do it, avoid use of SYS_INIT. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
6ec74d02b6
commit
2294da24d7
3 changed files with 10 additions and 11 deletions
|
|
@ -238,7 +238,7 @@ int arc_core_mpu_buffer_validate(const void *addr, size_t size, int write)
|
||||||
* This function provides the default configuration mechanism for the Memory
|
* This function provides the default configuration mechanism for the Memory
|
||||||
* Protection Unit (MPU).
|
* Protection Unit (MPU).
|
||||||
*/
|
*/
|
||||||
static int arc_mpu_init(void)
|
void arc_mpu_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint32_t num_regions = get_num_regions();
|
uint32_t num_regions = get_num_regions();
|
||||||
|
|
@ -246,7 +246,6 @@ static int arc_mpu_init(void)
|
||||||
if (mpu_config.num_regions > num_regions) {
|
if (mpu_config.num_regions > num_regions) {
|
||||||
__ASSERT(0, "Request to configure: %u regions (supported: %u)\n",
|
__ASSERT(0, "Request to configure: %u regions (supported: %u)\n",
|
||||||
mpu_config.num_regions, num_regions);
|
mpu_config.num_regions, num_regions);
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable MPU */
|
/* Disable MPU */
|
||||||
|
|
@ -278,10 +277,7 @@ static int arc_mpu_init(void)
|
||||||
|
|
||||||
/* Enable MPU */
|
/* Enable MPU */
|
||||||
arc_core_mpu_enable();
|
arc_core_mpu_enable();
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SYS_INIT(arc_mpu_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
|
||||||
|
|
||||||
#endif /* ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_COMMON_INTERNAL_H_ */
|
#endif /* ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_COMMON_INTERNAL_H_ */
|
||||||
|
|
|
||||||
|
|
@ -814,7 +814,7 @@ int arc_core_mpu_buffer_validate(const void *addr, size_t size, int write)
|
||||||
* This function provides the default configuration mechanism for the Memory
|
* This function provides the default configuration mechanism for the Memory
|
||||||
* Protection Unit (MPU).
|
* Protection Unit (MPU).
|
||||||
*/
|
*/
|
||||||
static int arc_mpu_init(void)
|
void arc_mpu_init(void)
|
||||||
{
|
{
|
||||||
uint32_t num_regions;
|
uint32_t num_regions;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
@ -826,7 +826,7 @@ static int arc_mpu_init(void)
|
||||||
__ASSERT(0,
|
__ASSERT(0,
|
||||||
"Request to configure: %u regions (supported: %u)\n",
|
"Request to configure: %u regions (supported: %u)\n",
|
||||||
mpu_config.num_regions, num_regions);
|
mpu_config.num_regions, num_regions);
|
||||||
return -EINVAL;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static_regions_num = 0U;
|
static_regions_num = 0U;
|
||||||
|
|
@ -851,7 +851,7 @@ static int arc_mpu_init(void)
|
||||||
MPU_DYNAMIC_REGION_AREAS_NUM) {
|
MPU_DYNAMIC_REGION_AREAS_NUM) {
|
||||||
LOG_ERR("not enough dynamic regions %d",
|
LOG_ERR("not enough dynamic regions %d",
|
||||||
dynamic_regions_num);
|
dynamic_regions_num);
|
||||||
return -EINVAL;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dyn_reg_info[dynamic_regions_num].index = i;
|
dyn_reg_info[dynamic_regions_num].index = i;
|
||||||
|
|
@ -886,10 +886,8 @@ static int arc_mpu_init(void)
|
||||||
/* Enable MPU */
|
/* Enable MPU */
|
||||||
arc_core_mpu_enable();
|
arc_core_mpu_enable();
|
||||||
|
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SYS_INIT(arc_mpu_init, PRE_KERNEL_1,
|
|
||||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
|
||||||
|
|
||||||
#endif /* ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V4_INTERNAL_H_ */
|
#endif /* ZEPHYR_ARCH_ARC_CORE_MPU_ARC_MPU_V4_INTERNAL_H_ */
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,8 @@ static void dev_state_zero(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern FUNC_NORETURN void z_cstart(void);
|
extern FUNC_NORETURN void z_cstart(void);
|
||||||
|
extern void arc_mpu_init(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prepare to and run C code
|
* @brief Prepare to and run C code
|
||||||
*
|
*
|
||||||
|
|
@ -138,6 +140,9 @@ void z_prep_c(void)
|
||||||
z_data_copy();
|
z_data_copy();
|
||||||
#if CONFIG_ARCH_CACHE
|
#if CONFIG_ARCH_CACHE
|
||||||
arch_cache_init();
|
arch_cache_init();
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_ARC_MPU
|
||||||
|
arc_mpu_init();
|
||||||
#endif
|
#endif
|
||||||
z_cstart();
|
z_cstart();
|
||||||
CODE_UNREACHABLE;
|
CODE_UNREACHABLE;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue