AM64x MCU+ SDK  08.02.00
MmuP_armv8.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2021 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef MMUP_ARMV8_H
34 #define MMUP_ARMV8_H
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 #include <stdint.h>
42 #include <kernel/dpl/SystemP.h>
43 
56 typedef enum MmuP_AccessPerm_ {
62 
66 typedef enum MmuP_Shareable_ {
69  MMUP_SHARABLE_INNER = 0x3
71 
75 typedef enum MmuP_AttrIndx_ {
85 
92 typedef struct MmuP_MapAttrs_ {
94  uint8_t privExecute;
95  uint8_t userExecute;
98  uint8_t global;
100 
104 typedef struct MmuP_Config_ {
105  uint32_t numRegions;
106  uint8_t enableMmu;
107 } MmuP_Config;
108 
112 typedef struct MmuP_RegionConfig_ {
113  uint64_t vaddr;
114  uint64_t paddr;
115  uint32_t size;
118 
127 
131 void MmuP_enable();
132 
136 void MmuP_disable(void);
137 
143 uint32_t MmuP_isEnabled();
144 
145 /* Memory map */
146 
157 int32_t MmuP_map(uintptr_t vaddr, uintptr_t paddr, uint32_t size, MmuP_MapAttrs *mapAttrs);
158 
163 void MmuP_init();
164 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 #endif /* MMUP_ARMV8_H */
MMUP_ACCESS_PERM_PRIV_RO_USER_NONE
@ MMUP_ACCESS_PERM_PRIV_RO_USER_NONE
Definition: MmuP_armv8.h:59
MmuP_MapAttrs::accessPerm
MmuP_AccessPerm accessPerm
Definition: MmuP_armv8.h:93
MMUP_ATTRINDX_MAIR0
@ MMUP_ATTRINDX_MAIR0
Definition: MmuP_armv8.h:76
size
uint16_t size
Definition: tisci_boardcfg.h:1
MmuP_AccessPerm
MmuP_AccessPerm
Enum's to represent different types of access permissions that are possible for a given MMU region.
Definition: MmuP_armv8.h:56
MmuP_RegionConfig::size
uint32_t size
Definition: MmuP_armv8.h:115
MMUP_ATTRINDX_MAIR3
@ MMUP_ATTRINDX_MAIR3
Definition: MmuP_armv8.h:79
SystemP.h
MmuP_MapAttrs::userExecute
uint8_t userExecute
Definition: MmuP_armv8.h:95
MmuP_MapAttrs
Attribute's to apply for a MMU region.
Definition: MmuP_armv8.h:92
MmuP_enable
void MmuP_enable()
Enable MMU sub-system.
MMUP_ATTRINDX_MAIR7
@ MMUP_ATTRINDX_MAIR7
Definition: MmuP_armv8.h:83
MMUP_ACCESS_PERM_PRIV_RW_USER_NONE
@ MMUP_ACCESS_PERM_PRIV_RW_USER_NONE
Definition: MmuP_armv8.h:57
MmuP_RegionConfig::attr
MmuP_MapAttrs attr
Definition: MmuP_armv8.h:116
MmuP_MapAttrs::attrIndx
MmuP_AttrIndx attrIndx
Definition: MmuP_armv8.h:97
MmuP_disable
void MmuP_disable(void)
Disable MMU sub-system.
MmuP_RegionConfig::vaddr
uint64_t vaddr
Definition: MmuP_armv8.h:113
MmuP_MapAttrs_init
void MmuP_MapAttrs_init(MmuP_MapAttrs *attrs)
Set default values to MmuP_MapAttrs.
MmuP_Config::enableMmu
uint8_t enableMmu
Definition: MmuP_armv8.h:106
MMUP_ATTRINDX_MAIR2
@ MMUP_ATTRINDX_MAIR2
Definition: MmuP_armv8.h:78
MmuP_MapAttrs::shareable
MmuP_Shareable shareable
Definition: MmuP_armv8.h:96
MmuP_Config
MMU config structure, this used by SysConfig and not to be used by end-users directly.
Definition: MmuP_armv8.h:104
MMUP_SHARABLE_OUTER
@ MMUP_SHARABLE_OUTER
Definition: MmuP_armv8.h:68
MmuP_Shareable
MmuP_Shareable
Enum's to represent MMU region sharable status.
Definition: MmuP_armv8.h:66
MmuP_MapAttrs::global
uint8_t global
Definition: MmuP_armv8.h:98
MmuP_RegionConfig::paddr
uint64_t paddr
Definition: MmuP_armv8.h:114
MMUP_SHARABLE_NONE
@ MMUP_SHARABLE_NONE
Definition: MmuP_armv8.h:67
MMUP_ATTRINDX_MAIR5
@ MMUP_ATTRINDX_MAIR5
Definition: MmuP_armv8.h:81
MMUP_ACCESS_PERM_PRIV_RW_USER_RW
@ MMUP_ACCESS_PERM_PRIV_RW_USER_RW
Definition: MmuP_armv8.h:58
MmuP_isEnabled
uint32_t MmuP_isEnabled()
Check if MMU sub-system is enabled.
MmuP_MapAttrs::privExecute
uint8_t privExecute
Definition: MmuP_armv8.h:94
MMUP_ATTRINDX_MAIR1
@ MMUP_ATTRINDX_MAIR1
Definition: MmuP_armv8.h:77
MMUP_ATTRINDX_MAIR4
@ MMUP_ATTRINDX_MAIR4
Definition: MmuP_armv8.h:80
MmuP_RegionConfig
Region config structure, this used by SysConfig and not to be used by end-users directly.
Definition: MmuP_armv8.h:112
MMUP_ACCESS_PERM_PRIV_RO_USER_RO
@ MMUP_ACCESS_PERM_PRIV_RO_USER_RO
Definition: MmuP_armv8.h:60
MmuP_init
void MmuP_init()
Initialize MMU sub-system, called by SysConfig, not to be called by end users.
MmuP_map
int32_t MmuP_map(uintptr_t vaddr, uintptr_t paddr, uint32_t size, MmuP_MapAttrs *mapAttrs)
Setup a region in the MMU.
MMUP_SHARABLE_INNER
@ MMUP_SHARABLE_INNER
Definition: MmuP_armv8.h:69
MMUP_ATTRINDX_MAIR6
@ MMUP_ATTRINDX_MAIR6
Definition: MmuP_armv8.h:82
MmuP_Config::numRegions
uint32_t numRegions
Definition: MmuP_armv8.h:105
MmuP_AttrIndx
MmuP_AttrIndx
Enum's to represent MMU attribute index.
Definition: MmuP_armv8.h:75