diff options
Diffstat (limited to 'include/lib')
| -rw-r--r-- | include/lib/aarch32/arch.h | 13 | ||||
| -rw-r--r-- | include/lib/aarch32/arch_helpers.h | 18 | ||||
| -rw-r--r-- | include/lib/aarch64/arch.h | 10 | ||||
| -rw-r--r-- | include/lib/aarch64/arch_helpers.h | 8 | ||||
| -rw-r--r-- | include/lib/xlat_tables/xlat_tables_v2.h | 26 |
5 files changed, 74 insertions, 1 deletions
diff --git a/include/lib/aarch32/arch.h b/include/lib/aarch32/arch.h index 8525c7ba..bc492b28 100644 --- a/include/lib/aarch32/arch.h +++ b/include/lib/aarch32/arch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -332,6 +332,15 @@ #define PMCR_N_BITS (PMCR_N_MASK << PMCR_N_SHIFT) /******************************************************************************* + * Definitions of register offsets, fields and macros for CPU system + * instructions. + ******************************************************************************/ + +#define TLBI_ADDR_SHIFT 0 +#define TLBI_ADDR_MASK 0xFFFFF000 +#define TLBI_ADDR(x) (((x) >> TLBI_ADDR_SHIFT) & TLBI_ADDR_MASK) + +/******************************************************************************* * Definitions of register offsets and fields in the CNTCTLBase Frame of the * system level implementation of the Generic Timer. ******************************************************************************/ @@ -378,6 +387,8 @@ #define TLBIALLIS p15, 0, c8, c3, 0 #define TLBIMVA p15, 0, c8, c7, 1 #define TLBIMVAA p15, 0, c8, c7, 3 +#define TLBIMVAAIS p15, 0, c8, c3, 3 +#define BPIALLIS p15, 0, c7, c1, 6 #define HSCTLR p15, 4, c1, c0, 0 #define HCR p15, 4, c1, c1, 0 #define HCPTR p15, 4, c1, c1, 2 diff --git a/include/lib/aarch32/arch_helpers.h b/include/lib/aarch32/arch_helpers.h index 3a82a7b3..a7d33d86 100644 --- a/include/lib/aarch32/arch_helpers.h +++ b/include/lib/aarch32/arch_helpers.h @@ -131,6 +131,13 @@ static inline void tlbi##_op(void) \ __asm__ volatile ("mcr "#coproc","#opc1",%0,"#CRn","#CRm","#opc2 : : "r" (v));\ } +#define _DEFINE_BPIOP_FUNC(_op, coproc, opc1, CRn, CRm, opc2) \ +static inline void bpi##_op(void) \ +{ \ + u_register_t v = 0; \ + __asm__ volatile ("mcr "#coproc","#opc1",%0,"#CRn","#CRm","#opc2 : : "r" (v));\ +} + #define _DEFINE_TLBIOP_PARAM_FUNC(_op, coproc, opc1, CRn, CRm, opc2) \ static inline void tlbi##_op(u_register_t v) \ { \ @@ -145,6 +152,10 @@ static inline void tlbi##_op(u_register_t v) \ #define DEFINE_TLBIOP_PARAM_FUNC(_op, ...) \ _DEFINE_TLBIOP_PARAM_FUNC(_op, __VA_ARGS__) +/* Define function for simple BPI operation */ +#define DEFINE_BPIOP_FUNC(_op, ...) \ + _DEFINE_BPIOP_FUNC(_op, __VA_ARGS__) + /********************************************************************** * Macros to create inline functions for DC operations *********************************************************************/ @@ -199,6 +210,7 @@ DEFINE_SYSOP_FUNC(sev) DEFINE_SYSOP_TYPE_FUNC(dsb, sy) DEFINE_SYSOP_TYPE_FUNC(dmb, sy) DEFINE_SYSOP_TYPE_FUNC(dsb, ish) +DEFINE_SYSOP_TYPE_FUNC(dsb, ishst) DEFINE_SYSOP_TYPE_FUNC(dmb, ish) DEFINE_SYSOP_FUNC(isb) @@ -263,6 +275,12 @@ DEFINE_TLBIOP_FUNC(all, TLBIALL) DEFINE_TLBIOP_FUNC(allis, TLBIALLIS) DEFINE_TLBIOP_PARAM_FUNC(mva, TLBIMVA) DEFINE_TLBIOP_PARAM_FUNC(mvaa, TLBIMVAA) +DEFINE_TLBIOP_PARAM_FUNC(mvaais, TLBIMVAAIS) + +/* + * BPI operation prototypes. + */ +DEFINE_BPIOP_FUNC(allis, BPIALLIS) /* * DC operation prototypes diff --git a/include/lib/aarch64/arch.h b/include/lib/aarch64/arch.h index 5876ce81..f1ad9bb4 100644 --- a/include/lib/aarch64/arch.h +++ b/include/lib/aarch64/arch.h @@ -31,6 +31,7 @@ #ifndef __ARCH_H__ #define __ARCH_H__ +#include <utils.h> /******************************************************************************* * MIDR bit definitions @@ -418,6 +419,15 @@ #define EC_BITS(x) (x >> ESR_EC_SHIFT) & ESR_EC_MASK /******************************************************************************* + * Definitions of register offsets, fields and macros for CPU system + * instructions. + ******************************************************************************/ + +#define TLBI_ADDR_SHIFT 12 +#define TLBI_ADDR_MASK ULL(0x00000FFFFFFFFFFF) +#define TLBI_ADDR(x) (((x) >> TLBI_ADDR_SHIFT) & TLBI_ADDR_MASK) + +/******************************************************************************* * Definitions of register offsets and fields in the CNTCTLBase Frame of the * system level implementation of the Generic Timer. ******************************************************************************/ diff --git a/include/lib/aarch64/arch_helpers.h b/include/lib/aarch64/arch_helpers.h index d70c9aee..d4507cc8 100644 --- a/include/lib/aarch64/arch_helpers.h +++ b/include/lib/aarch64/arch_helpers.h @@ -124,6 +124,13 @@ DEFINE_SYSOP_TYPE_FUNC(tlbi, alle3) DEFINE_SYSOP_TYPE_FUNC(tlbi, alle3is) DEFINE_SYSOP_TYPE_FUNC(tlbi, vmalle1) +DEFINE_SYSOP_TYPE_PARAM_FUNC(tlbi, vaae1is) +DEFINE_SYSOP_TYPE_PARAM_FUNC(tlbi, vaale1is) +DEFINE_SYSOP_TYPE_PARAM_FUNC(tlbi, vae2is) +DEFINE_SYSOP_TYPE_PARAM_FUNC(tlbi, vale2is) +DEFINE_SYSOP_TYPE_PARAM_FUNC(tlbi, vae3is) +DEFINE_SYSOP_TYPE_PARAM_FUNC(tlbi, vale3is) + /******************************************************************************* * Cache maintenance accessor prototypes ******************************************************************************/ @@ -181,6 +188,7 @@ DEFINE_SYSOP_TYPE_FUNC(dmb, sy) DEFINE_SYSOP_TYPE_FUNC(dmb, st) DEFINE_SYSOP_TYPE_FUNC(dmb, ld) DEFINE_SYSOP_TYPE_FUNC(dsb, ish) +DEFINE_SYSOP_TYPE_FUNC(dsb, ishst) DEFINE_SYSOP_TYPE_FUNC(dmb, ish) DEFINE_SYSOP_FUNC(isb) diff --git a/include/lib/xlat_tables/xlat_tables_v2.h b/include/lib/xlat_tables/xlat_tables_v2.h index 6fec57d4..16b857cc 100644 --- a/include/lib/xlat_tables/xlat_tables_v2.h +++ b/include/lib/xlat_tables/xlat_tables_v2.h @@ -59,6 +59,7 @@ #define MT_SEC_SHIFT 4 /* Access permissions for instruction execution (EXECUTE/EXECUTE_NEVER) */ #define MT_EXECUTE_SHIFT 5 +/* All other bits are reserved */ /* * Memory mapping attributes @@ -116,11 +117,36 @@ void mmap_add_region(unsigned long long base_pa, uintptr_t base_va, size_t size, unsigned int attr); /* + * Add a region with defined base PA and base VA. This type of region can be + * added and removed even if the MMU is enabled. + * + * Returns: + * 0: Success. + * EINVAL: Invalid values were used as arguments. + * ERANGE: Memory limits were surpassed. + * ENOMEM: Not enough space in the mmap array or not enough free xlat tables. + * EPERM: It overlaps another region in an invalid way. + */ +int mmap_add_dynamic_region(unsigned long long base_pa, uintptr_t base_va, + size_t size, unsigned int attr); + +/* * Add an array of static regions with defined base PA and base VA. This type * of region can only be added before initializing the MMU and cannot be * removed later. */ void mmap_add(const mmap_region_t *mm); +/* + * Remove a region with the specified base VA and size. Only dynamic regions can + * be removed, and they can be removed even if the MMU is enabled. + * + * Returns: + * 0: Success. + * EINVAL: The specified region wasn't found. + * EPERM: Trying to remove a static region. + */ +int mmap_remove_dynamic_region(uintptr_t base_va, size_t size); + #endif /*__ASSEMBLY__*/ #endif /* __XLAT_TABLES_V2_H__ */ |
