bl30: rtos_sdk add pmp protection [2/2]
PD#SWPL-140705
Problem:
bl30: add pmp protection (for rtos_sdk)
Solution:
.text/rodata permission: R/X
.data/stack/heap permission: R/W
back ground all 4G region: R/W
application to both M and U mode.
Verify:
a5_av409, s5_ax201, t5m_ay301, t3x_bc302, s1a_bg201
Change-Id: I281e647c0baf33c23655f2eae0f0d51c18371362
Signed-off-by: bangzheng.liu <bangzheng.liu@amlogic.com>
diff --git a/n200_func.h b/n200_func.h
index a542180..cf71867 100644
--- a/n200_func.h
+++ b/n200_func.h
@@ -17,6 +17,30 @@
#endif
#include "gcc_compiler_attributes.h"
+#define PMP_CFG_R_NO (0<<0)
+#define PMP_CFG_R_EN (1<<0)
+
+#define PMP_CFG_W_NO (0<<1)
+#define PMP_CFG_W_EN (1<<1)
+
+#define PMP_CFG_X_NO (0<<2)
+#define PMP_CFG_X_EN (1<<2)
+
+#define PMP_CFG_A_OFF (0<<3)
+#define PMP_CFG_A_NA4 (2<<3)
+#define PMP_CFG_A_NAPOT (3<<3)
+
+#define PMP_CFG_L_NO (0<<7)
+#define PMP_CFG_L_EN (1<<7)
+
+/* The size should be the number of 2^n */
+#define NAPOT_SIZE(size) (((size) - 1) >> 3)
+
+extern uint32_t _text;
+extern uint32_t _etext;
+
+uint32_t config_pmp(void);
+
void pmp_open_all_space(void);
void switch_m2u_mode(void);