arm_mpu:Fix mpu_initialize not taking effect

Modified the input parameters of mpu_initialize to require the caller to provide the number of entries in the table

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
chenrun1 2024-05-22 15:13:33 +08:00 committed by Xiang Xiao
parent 62f598e547
commit 054c564a2d
6 changed files with 22 additions and 16 deletions

View File

@ -558,6 +558,7 @@ unsigned int mpu_configure_region(uintptr_t base, size_t size,
*
* Input Parameters:
* table - MPU initialization table.
* count - Initialize the number of entries in the region table.
* hfnmiena - A boolean indicating whether the MPU should enable the
* HFNMIENA bit.
* privdefena - A boolean indicating whether the MPU should enable the
@ -568,14 +569,14 @@ unsigned int mpu_configure_region(uintptr_t base, size_t size,
*
****************************************************************************/
void mpu_initialize(const struct mpu_region_s *table, bool hfnmiena,
bool privdefena)
void mpu_initialize(const struct mpu_region_s *table, size_t count,
bool hfnmiena, bool privdefena)
{
const struct mpu_region_s *conf;
int index;
size_t index;
mpu_control(false, false, false);
for (index = 0; index < nitems(table); index++)
for (index = 0; index < count; index++)
{
conf = &table[index];
mpu_configure_region(conf->base, conf->size, conf->flags);

View File

@ -380,6 +380,7 @@ unsigned int mpu_configure_region(uintptr_t base, size_t size,
*
* Input Parameters:
* table - MPU initialization table.
* count - Initialize the number of entries in the region table.
* hfnmiena - A boolean indicating whether the MPU should enable the
* HFNMIENA bit.
* privdefena - A boolean indicating whether the MPU should enable the
@ -390,8 +391,8 @@ unsigned int mpu_configure_region(uintptr_t base, size_t size,
*
****************************************************************************/
void mpu_initialize(const struct mpu_region_s *table, bool hfnmiena,
bool privdefena);
void mpu_initialize(const struct mpu_region_s *table, size_t count,
bool hfnmiena, bool privdefena);
/****************************************************************************
* Inline Functions

View File

@ -486,19 +486,20 @@ unsigned int mpu_configure_region(uintptr_t base, size_t size,
*
* Input Parameters:
* table - MPU Initiaze table.
* count - Initialize the number of entries in the region table.
*
* Returned Value:
* NULL.
*
****************************************************************************/
void mpu_initialize(const struct mpu_region_s *table)
void mpu_initialize(const struct mpu_region_s *table, size_t count)
{
const struct mpu_region_s *conf;
int index;
size_t index;
mpu_control(false);
for (index = 0; index < nitems(table); index++)
for (index = 0; index < count; index++)
{
conf = &table[index];
mpu_configure_region(conf->base, conf->size, conf->flags);

View File

@ -318,13 +318,14 @@ unsigned int mpu_configure_region(uintptr_t base, size_t size,
*
* Input Parameters:
* table - MPU Initiaze table.
* count - Initialize the number of entries in the region table.
*
* Returned Value:
* NULL.
*
****************************************************************************/
void mpu_initialize(const struct mpu_region_s *table);
void mpu_initialize(const struct mpu_region_s *table, size_t count);
/****************************************************************************
* Inline Functions

View File

@ -289,6 +289,7 @@ unsigned int mpu_configure_region(uintptr_t base, size_t size,
*
* Input Parameters:
* table - MPU initialization table.
* count - Initialize the number of entries in the region table.
* hfnmiena - A boolean indicating whether the MPU should enable the
* HFNMIENA bit.
* privdefena - A boolean indicating whether the MPU should enable the
@ -299,14 +300,14 @@ unsigned int mpu_configure_region(uintptr_t base, size_t size,
*
****************************************************************************/
void mpu_initialize(const struct mpu_region_s *table, bool hfnmiena,
bool privdefena)
void mpu_initialize(const struct mpu_region_s *table, size_t count,
bool hfnmiena, bool privdefena)
{
const struct mpu_region_s *conf;
int index;
size_t index;
mpu_control(false, false, false);
for (index = 0; index < nitems(table); index++)
for (index = 0; index < count; index++)
{
conf = &table[index];
mpu_configure_region(conf->base, conf->size, conf->flags1,

View File

@ -347,6 +347,7 @@ unsigned int mpu_configure_region(uintptr_t base, size_t size,
*
* Input Parameters:
* table - MPU initialization table.
* count - Initialize the number of entries in the region table.
* hfnmiena - A boolean indicating whether the MPU should enable the
* HFNMIENA bit.
* privdefena - A boolean indicating whether the MPU should enable the
@ -357,8 +358,8 @@ unsigned int mpu_configure_region(uintptr_t base, size_t size,
*
****************************************************************************/
void mpu_initialize(const struct mpu_region_s *table, bool hfnmiena,
bool privdefena);
void mpu_initialize(const struct mpu_region_s *table, size_t count,
bool hfnmiena, bool privdefena);
/****************************************************************************
* Inline Functions