Go to the source code of this file.
Classes | |
| struct | devmap |
| struct | ptable |
| struct | cpu_section |
| Section page table entry. More... | |
| struct | sw_page_ref |
| Page table reference. More... | |
Typedefs | |
| typedef enum mem_access_ctrl | ACCESS_TYPE |
Enumerations | |
| enum | mem_access_ctrl { PRIV_NO_USR_NO = 0, PRIV_RW_USR_NO = 1, PRIV_RW_USR_RO = 2, PRIV_RW_USR_RW = 3, AP_RESERVED = 4, PRIV_RO_USR_NO = 5, DEPRECATED = 6, PRIV_RO_USR_RO = 7 } |
| Memory access control constants. More... | |
Functions | |
| u32 * | get_secure_ptd (void) |
| Returns the secure page table pointer. More... | |
| u32 * | map_secure_page_table (void) |
| Initialize page table entries. More... | |
| int | __map_to_ns (pa_t phy_addr, va_t *va_addr) |
| Create shared memory mapping between secure and non-secure kernel. More... | |
| int | ns_map (pa_t phy_addr, va_t *va_addr, pa_t size) |
| Wrapper function for __map_to_ns. More... | |
| int | __unmap_from_ns (va_t va_addr) |
| Unmap the non-secure memory from secure page table. More... | |
| int | mem_ns_unmap (va_t va_addr, pa_t size) |
| Wrapper function for __unmap_from_ns. More... | |
| int | map_device_table (const struct devmap *dt) |
| Map device table. More... | |
| int | map_device (va_t va, pa_t pa, u32 size) |
| Map devices. More... | |
| int | map_user_access_device_table (const struct devmap *dt) |
| Map User Access device table. More... | |
| int | map_user_access_device (va_t va, pa_t pa, u32 size) |
| Map user access devices. More... | |
| int | map_secure_memory (va_t va, pa_t pa, u32 size, u32 ptf) |
| Map a range of secure memory. More... | |
| int | unmap_secure_memory (va_t va, u32 size) |
| Unmap a range of secure memory area. More... | |
| int | map_nsmemsect_normal (va_t, pa_t, u32) |
| Map a range of non secure memory area as normal memory with attributes Outer and Inner write back, write allocate. More... | |
| int | unmap_nsmemsect_normal (va_t, u32) |
| Unmap a range of non secure memory area. More... | |
| int | map_section_entry (u32 *pgd, struct cpu_section *entry) |
| Create a section map entry. More... | |
| int | unmap_section_entry (u32 *pgd, va_t va) |
| int | map_ns_section_entry (u32 *pgd, struct cpu_section *entry) |
| Map the non-secure memory in secure page table for shared memory access. More... | |
| int | unmap_ns_section_entry (u32 *pgd, va_t va) |
| Unmap the shared section entry from secure page table. More... | |
| int | map_to_secure (pa_t phy_addr, va_t va_addr) |
| int | unmap_from_secure (va_t va_addr) |
| int | page_ref_add (u32 l1_pte) |
| Increment page table reference of shared memory. More... | |
| int | page_ref_release (u32 l1_pte) |
| Decrement page table reference of shared memory. More... | |
| void | sw_seterrno (int x) |
| int | mem_kunmap (va_t va, va_t size) |
| int | mem_kmap (va_t va, pa_t pa, va_t size) |
| #define ALIGN_MASK (~(MAP_SIZE - 1)) |
| #define FSR_ALIGN_FAULT 0x1 |
| #define FSR_DOMAIN_MASK 0xf0 |
| #define FSR_DOMAIN_PAG 0xb |
| #define FSR_DOMAIN_SEC 0x9 |
| #define FSR_EXT_ABORT_L1 0xc |
| #define FSR_EXT_ABORT_L2 0xe |
| #define FSR_EXT_MASK 0x1000 |
| #define FSR_PERM_PAGE 0xf |
| #define FSR_PERM_SEC 0xd |
| #define FSR_TRANS_PAGE 0x7 |
| #define FSR_TRANS_SEC 0x5 |
| #define FSR_TYPE_MASK 0x40f |
| #define FSR_WNR_MASK 0x800 |
| #define kpa_to_kva | ( | x | ) | (((x) - KERN_PA_BASE) + KERN_VA_BASE) |
| #define kpa_to_kva | ( | x | ) | (((x) - KERN_PA_BASE) + KERN_VA_BASE) |
| #define kva_to_kpa | ( | x | ) | (((x) - KERN_VA_BASE) + KERN_PA_BASE) |
| #define kva_to_kpa | ( | x | ) | (((x) - KERN_VA_BASE) + KERN_PA_BASE) |
| #define L1_DOMAIN_IDX_MASK (L1_DOMAIN_MASK << L1_DOMAIN_SHIFT) |
| #define L1_DOMAIN_MASK 0xf |
| #define L1_DOMAIN_SHIFT 5 |
| #define L1_EXECUTE_ALLOW 0 |
| #define L1_EXECUTE_NEVER 1 |
| #define L1_SECTION_AP2_SHIFT 15 |
| #define L1_SECTION_AP_MASK 0x3 |
| #define L1_SECTION_AP_SHIFT 10 |
| #define L1_SECTION_B_SHIFT 2 |
| #define L1_SECTION_C_SHIFT 3 |
| #define L1_SECTION_NG_SHIFT 17 /* Non-Global bit*/ |
| #define L1_SECTION_NS_IDX_MASK (L1_SECTION_NS_MASK << L1_SECTION_NS_SHIFT) |
| #define L1_SECTION_NS_MASK 0x1 |
| #define L1_SECTION_NS_SHIFT 19 /* Non-Secure bit*/ |
| #define L1_SECTION_S_SHIFT 16 |
| #define L1_SECTION_TEX_SHIFT 12 |
| #define L1_SECTION_XN_SHIFT 4 |
| #define L1_TYPE_COARSE 0x1 |
| #define L1_TYPE_FAULT 0x0 |
| #define L1_TYPE_MASK 0x3 |
| #define L1_TYPE_SECTION 0x2 |
| #define LEVEL0_OFFSET_MASK 0x0000ff8000000000 |
| #define LEVEL_OFFSET_BITS 9 |
| #define LEVEL_OFFSET_MASK | ( | x | ) | (LEVEL0_OFFSET_MASK >> (x * LEVEL_OFFSET_BITS)) |
| #define LEVEL_OFFSET_SHIFT | ( | x | ) | ((4 - x) * LEVEL_OFFSET_BITS) |
| #define MAP_SIZE SECTION_SIZE |
| #define PAGE_TABLE_ENTRIES 4096 |
| #define PAGE_TABLE_ENTRY_WIDTH 4 |
| #define PAGE_TABLE_SIZE (PAGE_TABLE_ENTRIES * PAGE_TABLE_ENTRY_WIDTH) |
| #define PT_STAGE_1 0 |
| #define PTF_EXEC (1 << PTF_EXEC_SHIFT) |
| #define PTF_EXEC_MASK 0x8 |
| #define PTF_EXEC_SHIFT 0x3 |
| #define PTF_PROT_KRO (PRIV_RO_USR_NO) |
| #define PTF_PROT_KRW (PRIV_RW_USR_NO) |
| #define PTF_PROT_MASK 0x7 |
| #define PTF_PROT_URO (PRIV_RW_USR_RO) |
| #define PTF_PROT_URW (PRIV_RW_USR_RW) |
| #define ptf_to_ap | ( | x | ) | ((x) & PTF_PROT_MASK) |
| #define ptf_to_xn | ( | x | ) | ((~(x) & PTF_EXEC_MASK) >> PTF_EXEC_SHIFT) |
| #define SECTION_BASE_MASK 0xfff00000 |
| #define SECTION_SIZE (1 << 20) |
| #define SECURE_ACCESS_DOMAIN 0 |
| #define START_LEVEL 1 |
| #define SW_EINVAL -2 |
| typedef enum mem_access_ctrl ACCESS_TYPE |
| enum mem_access_ctrl |
Memory access control constants.
| int __map_to_ns | ( | pa_t | phy_addr, |
| va_t * | va_addr | ||
| ) |
Create shared memory mapping between secure and non-secure kernel.
This function creates the page table entry with ns bit set. So that this section of the non-secure memory act like a shared memory.
| phy_addr | Physical address of the non-secure memory |
| va_addr | Virtual address of the shared memory |
| int __unmap_from_ns | ( | va_t | va_addr | ) |
Unmap the non-secure memory from secure page table.
This function unmaps the non-secure memory from secure page table. i.e. set 'NS' bit to zero
| va_addr | Virtual address to be unmapped |
| u32* get_secure_ptd | ( | void | ) |
Returns the secure page table pointer.
Returns the secure page table pointer.
This function returns the page table pointer
| int map_device | ( | va_t | va, |
| pa_t | pa, | ||
| u32 | size | ||
| ) |
Map devices.
This function assumes that the start address and size are section aligned.
| va | : virtual address |
| pa | : physical address |
| size | : size |
| int map_device_table | ( | const struct devmap * | dt | ) |
Map device table.
| dt | pointer to array of device mappings Array has to terminated with zero. |
| int map_ns_section_entry | ( | u32 * | pgd, |
| struct cpu_section * | entry | ||
| ) |
Map the non-secure memory in secure page table for shared memory access.
This function creates the section mapping with 'NS' bit set to create a shared memory access.
| pgd | Pointer to page table |
| entry | Pointer to section entry |
| int map_nsmemsect_normal | ( | va_t | va, |
| pa_t | pa, | ||
| u32 | size | ||
| ) |
Map a range of non secure memory area as normal memory with attributes Outer and Inner write back, write allocate.
This function assumes that the start address and size are section aligned.
| va | virtual address |
| pa | physical address |
| size | size |
| int map_section_entry | ( | u32 * | pgd, |
| struct cpu_section * | entry | ||
| ) |
Create a section map entry.
This function creates section map entry in supplied page table
| pgd | Pointer to page table |
| entry | Pointer to section entry |
| int map_secure_memory | ( | va_t | va, |
| pa_t | pa, | ||
| u32 | size, | ||
| u32 | ptf | ||
| ) |
Map a range of secure memory.
This function assumes that the start address and size are section aligned.
| va | : virtual address |
| pa | : physical address |
| size | : size |
| ptf | : page table flag |
This function assumes that the start address and size are section aligned.
| va | : virtual address |
| pa | : physical address |
| size | : size |
| ptf | : page table flag |
| u32* map_secure_page_table | ( | void | ) |
Initialize page table entries.
This function creates the initial page table entries for secure kernel
| int map_to_secure | ( | pa_t | phy_addr, |
| va_t | va_addr | ||
| ) |
| phy_addr | |
| va_addr |
| int map_user_access_device | ( | va_t | va, |
| pa_t | pa, | ||
| u32 | size | ||
| ) |
Map user access devices.
This function assumes that the start address and size are section aligned.
| va | : virtual address |
| pa | : physical address |
| size | : size |
| int map_user_access_device_table | ( | const struct devmap * | dt | ) |
Map User Access device table.
| dt | pointer to array of device mappings Array has to terminated with zero. |
| int mem_kmap | ( | va_t | va, |
| pa_t | pa, | ||
| va_t | size | ||
| ) |
| int mem_kunmap | ( | va_t | va, |
| va_t | size | ||
| ) |
| int mem_ns_unmap | ( | va_t | va_addr, |
| pa_t | size | ||
| ) |
Wrapper function for __unmap_from_ns.
| va_addr |
| int ns_map | ( | pa_t | phy_addr, |
| va_t * | va_addr, | ||
| pa_t | size | ||
| ) |
Wrapper function for __map_to_ns.
| phy_addr | |
| va_addr |
| int page_ref_add | ( | u32 | l1_pte | ) |
Increment page table reference of shared memory.
This function increment the reference count of mapped shared memory
| l1_pte | Page table entry |
| int page_ref_release | ( | u32 | l1_pte | ) |
Decrement page table reference of shared memory.
This function decrement the reference count of mapped shared memory
| l1_pte | Page table entry |
| void sw_seterrno | ( | int | x | ) |
| int unmap_from_secure | ( | va_t | va_addr | ) |
| va_addr |
| int unmap_ns_section_entry | ( | u32 * | pgd, |
| va_t | va | ||
| ) |
Unmap the shared section entry from secure page table.
This function unmaps the secure memory section from secure page table. i.e. set 'NS' bit to zero
| pgd | Pointer to page table |
| va | Virtual address to be unmapped |
| int unmap_nsmemsect_normal | ( | va_t | va, |
| u32 | size | ||
| ) |
Unmap a range of non secure memory area.
This function assumes that the start address and size are section aligned.
| va | virtual address |
| size | size |
| int unmap_section_entry | ( | u32 * | pgd, |
| va_t | va | ||
| ) |
| pgd | |
| va |
| int unmap_secure_memory | ( | va_t | va, |
| u32 | size | ||
| ) |
Unmap a range of secure memory area.
This function assumes that the start address and size are section aligned.
| va | virtual address |
| size | size |
1.8.6