ARM: MPU: Arch specific memory domain APIs
Added architecture specific support for memory domain destroy and remove partition for arm and nxp. An optimized version of remove partition was also added. Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
parent
9bbe7bd61e
commit
7add3cdd82
3 changed files with 68 additions and 0 deletions
|
@ -52,4 +52,37 @@ int _arch_mem_domain_max_partitions_get(void)
|
|||
{
|
||||
return arm_core_mpu_get_max_domain_partition_regions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset MPU region for a single memory partition
|
||||
*
|
||||
* @param domain The memory domain structure
|
||||
* @param part_index memory partition index
|
||||
*/
|
||||
void _arch_mem_domain_remove_partition(struct k_mem_domain *domain,
|
||||
u32_t partition_id)
|
||||
{
|
||||
ARG_UNUSED(domain);
|
||||
|
||||
arm_core_mpu_disable();
|
||||
arm_core_mpu_remove_mem_partition(partition_id);
|
||||
arm_core_mpu_enable();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Destroy MPU regions for the mem domain
|
||||
*
|
||||
* @param domain The memory domain structure
|
||||
* @param part_index memory partition index
|
||||
*/
|
||||
void _arch_mem_domain_destroy(struct k_mem_domain *domain)
|
||||
{
|
||||
ARG_UNUSED(domain);
|
||||
|
||||
arm_core_mpu_disable();
|
||||
arm_core_mpu_configure_mem_domain(NULL);
|
||||
arm_core_mpu_enable();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -262,6 +262,23 @@ void arm_core_mpu_configure_mem_partition(u32_t part_index,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset MPU region for a single memory partition
|
||||
*
|
||||
* @param part_index memory partition index
|
||||
*/
|
||||
void arm_core_mpu_remove_mem_partition(u32_t part_index)
|
||||
{
|
||||
u32_t region_index =
|
||||
_get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION);
|
||||
|
||||
SYS_LOG_DBG("disable region 0x%x", region_index + part_index);
|
||||
/* Disable region */
|
||||
ARM_MPU_DEV->rnr = region_index + part_index;
|
||||
ARM_MPU_DEV->rbar = 0;
|
||||
ARM_MPU_DEV->rasr = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the maximum number of free regions for memory domain partitions
|
||||
*/
|
||||
|
|
|
@ -289,6 +289,24 @@ void arm_core_mpu_configure_mem_partition(u32_t part_index,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset MPU region for a single memory partition
|
||||
*
|
||||
* @param part_index memory partition index
|
||||
*/
|
||||
void arm_core_mpu_remove_mem_partition(u32_t part_index)
|
||||
{
|
||||
u32_t region_index =
|
||||
_get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION);
|
||||
|
||||
SYS_LOG_DBG("disable region 0x%x", region_index);
|
||||
/* Disable region */
|
||||
SYSMPU->WORD[region_index + part_index][0] = 0;
|
||||
SYSMPU->WORD[region_index + part_index][1] = 0;
|
||||
SYSMPU->WORD[region_index + part_index][2] = 0;
|
||||
SYSMPU->WORD[region_index + part_index][3] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the maximum number of free regions for memory domain partitions
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue