include: arm64: Refine the K_MEM_PARTITION_ defs
The defination of K_MEM_PARTITION_* marcos denpens on wheather it is mmu or mpu, so I move those definations for mmu into arm_mmu.h and create mpu relevant ones in arm_mpu.h Signed-off-by: Jaxson Han <jaxson.han@arm.com>
This commit is contained in:
parent
0f60930540
commit
9c1115c655
3 changed files with 36 additions and 31 deletions
|
@ -29,9 +29,7 @@
|
|||
#include <arch/arm64/sys_io.h>
|
||||
#include <arch/arm64/timer.h>
|
||||
#include <arch/arm64/error.h>
|
||||
#ifdef CONFIG_ARM_MMU
|
||||
#include <arch/arm64/arm_mmu.h>
|
||||
#endif
|
||||
#include <arch/arm64/mm.h>
|
||||
#include <arch/arm64/thread_stack.h>
|
||||
#include <arch/common/addr_types.h>
|
||||
#include <arch/common/sys_bitops.h>
|
||||
|
@ -45,34 +43,6 @@ extern "C" {
|
|||
|
||||
#include <sys/slist.h>
|
||||
|
||||
/* Kernel macros for memory attribution
|
||||
* (access permissions and cache-ability).
|
||||
*
|
||||
* The macros are to be stored in k_mem_partition_attr_t
|
||||
* objects. The format of a k_mem_partition_attr_t object
|
||||
* is an uint32_t composed by permission and attribute flags
|
||||
* located in include/arch/arm64/arm_mmu.h
|
||||
*/
|
||||
|
||||
/* Read-Write access permission attributes */
|
||||
#define K_MEM_PARTITION_P_RW_U_RW ((k_mem_partition_attr_t) \
|
||||
{MT_P_RW_U_RW})
|
||||
#define K_MEM_PARTITION_P_RW_U_NA ((k_mem_partition_attr_t) \
|
||||
{MT_P_RW_U_NA})
|
||||
#define K_MEM_PARTITION_P_RO_U_RO ((k_mem_partition_attr_t) \
|
||||
{MT_P_RO_U_RO})
|
||||
#define K_MEM_PARTITION_P_RO_U_NA ((k_mem_partition_attr_t) \
|
||||
{MT_P_RO_U_NA})
|
||||
|
||||
/* Execution-allowed attributes */
|
||||
#define K_MEM_PARTITION_P_RX_U_RX ((k_mem_partition_attr_t) \
|
||||
{MT_P_RX_U_RX})
|
||||
|
||||
/* Typedef for the k_mem_partition attribute */
|
||||
typedef struct {
|
||||
uint32_t attrs;
|
||||
} k_mem_partition_attr_t;
|
||||
|
||||
struct arch_mem_domain {
|
||||
#ifdef CONFIG_ARM_MMU
|
||||
struct arm_mmu_ptables ptables;
|
||||
|
|
|
@ -186,6 +186,30 @@ struct arm_mmu_ptables {
|
|||
#define MMU_REGION_FLAT_ENTRY(name, adr, sz, attrs) \
|
||||
MMU_REGION_ENTRY(name, adr, adr, sz, attrs)
|
||||
|
||||
/* Kernel macros for memory attribution
|
||||
* (access permissions and cache-ability).
|
||||
*
|
||||
* The macros are to be stored in k_mem_partition_attr_t
|
||||
* objects. The format of a k_mem_partition_attr_t object
|
||||
* is an uint32_t composed by permission and attribute flags
|
||||
* located in include/arch/arm64/arm_mmu.h
|
||||
*/
|
||||
|
||||
/* Read-Write access permission attributes */
|
||||
#define K_MEM_PARTITION_P_RW_U_RW ((k_mem_partition_attr_t) \
|
||||
{MT_P_RW_U_RW})
|
||||
#define K_MEM_PARTITION_P_RW_U_NA ((k_mem_partition_attr_t) \
|
||||
{MT_P_RW_U_NA})
|
||||
#define K_MEM_PARTITION_P_RO_U_RO ((k_mem_partition_attr_t) \
|
||||
{MT_P_RO_U_RO})
|
||||
#define K_MEM_PARTITION_P_RO_U_NA ((k_mem_partition_attr_t) \
|
||||
{MT_P_RO_U_NA})
|
||||
/* Execution-allowed attributes */
|
||||
#define K_MEM_PARTITION_P_RX_U_RX ((k_mem_partition_attr_t) \
|
||||
{MT_P_RX_U_RX})
|
||||
/* Typedef for the k_mem_partition attribute */
|
||||
typedef struct { uint32_t attrs; } k_mem_partition_attr_t;
|
||||
|
||||
/* Reference to the MMU configuration.
|
||||
*
|
||||
* This struct is defined and populated for each SoC (in the SoC definition),
|
||||
|
|
|
@ -219,6 +219,17 @@ struct arm_mpu_config {
|
|||
.attr = _attr, \
|
||||
}
|
||||
|
||||
#define K_MEM_PARTITION_P_RW_U_RW ((k_mem_partition_attr_t) \
|
||||
{(P_RW_U_RW_Msk), MPU_MAIR_INDEX_SRAM})
|
||||
#define K_MEM_PARTITION_P_RW_U_NA ((k_mem_partition_attr_t) \
|
||||
{(P_RW_U_NA_Msk), MPU_MAIR_INDEX_SRAM})
|
||||
#define K_MEM_PARTITION_P_RO_U_RO ((k_mem_partition_attr_t) \
|
||||
{(P_RO_U_RO_Msk), MPU_MAIR_INDEX_SRAM})
|
||||
#define K_MEM_PARTITION_P_RO_U_NA ((k_mem_partition_attr_t) \
|
||||
{(P_RO_U_NA_Msk), MPU_MAIR_INDEX_SRAM})
|
||||
|
||||
typedef struct arm_mpu_region_attr k_mem_partition_attr_t;
|
||||
|
||||
/* Reference to the MPU configuration.
|
||||
*
|
||||
* This struct is defined and populated for each SoC (in the SoC definition),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue