bl30: rtos_sdk add pmp protection [1/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: Ibe31a8b84ae352fff35f07f0d732f4c22a87f21b
Signed-off-by: bangzheng.liu <bangzheng.liu@amlogic.com>
diff --git a/av400_a113x2/hw_business.c b/av400_a113x2/hw_business.c
index e682484..126905d 100644
--- a/av400_a113x2/hw_business.c
+++ b/av400_a113x2/hw_business.c
@@ -59,6 +59,8 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
+
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/av400_a113x2/lscript.ld b/av400_a113x2/lscript.ld
index 69bded4..1e45aa2 100644
--- a/av400_a113x2/lscript.ld
+++ b/av400_a113x2/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/av409_a113x2/hw_business.c b/av409_a113x2/hw_business.c
index e682484..2548715 100644
--- a/av409_a113x2/hw_business.c
+++ b/av409_a113x2/hw_business.c
@@ -59,6 +59,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/av409_a113x2/lscript.ld b/av409_a113x2/lscript.ld
index 69bded4..1e45aa2 100644
--- a/av409_a113x2/lscript.ld
+++ b/av409_a113x2/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/ax201_s928x/hw_business.c b/ax201_s928x/hw_business.c
index d579f00..e670626 100644
--- a/ax201_s928x/hw_business.c
+++ b/ax201_s928x/hw_business.c
@@ -60,6 +60,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/ax201_s928x/lscript.ld b/ax201_s928x/lscript.ld
index 69bded4..1e45aa2 100644
--- a/ax201_s928x/lscript.ld
+++ b/ax201_s928x/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/ax208_s928x/hw_business.c b/ax208_s928x/hw_business.c
index d579f00..e670626 100644
--- a/ax208_s928x/hw_business.c
+++ b/ax208_s928x/hw_business.c
@@ -60,6 +60,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/ax208_s928x/lscript.ld b/ax208_s928x/lscript.ld
index 69bded4..1e45aa2 100644
--- a/ax208_s928x/lscript.ld
+++ b/ax208_s928x/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/ax209_s928x/hw_business.c b/ax209_s928x/hw_business.c
index d579f00..e670626 100644
--- a/ax209_s928x/hw_business.c
+++ b/ax209_s928x/hw_business.c
@@ -60,6 +60,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/ax209_s928x/lscript.ld b/ax209_s928x/lscript.ld
index 69bded4..1e45aa2 100644
--- a/ax209_s928x/lscript.ld
+++ b/ax209_s928x/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/ay301_t963d4/hw_business.c b/ay301_t963d4/hw_business.c
index 52cf054..900ce84 100644
--- a/ay301_t963d4/hw_business.c
+++ b/ay301_t963d4/hw_business.c
@@ -60,6 +60,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/ay301_t963d4/lscript.ld b/ay301_t963d4/lscript.ld
index c5cbe61..7fe4a56 100644
--- a/ay301_t963d4/lscript.ld
+++ b/ay301_t963d4/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/ay309_t963d4/hw_business.c b/ay309_t963d4/hw_business.c
index 52cf054..900ce84 100644
--- a/ay309_t963d4/hw_business.c
+++ b/ay309_t963d4/hw_business.c
@@ -60,6 +60,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/ay309_t963d4/lscript.ld b/ay309_t963d4/lscript.ld
index 69bded4..1e45aa2 100644
--- a/ay309_t963d4/lscript.ld
+++ b/ay309_t963d4/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/ba400_a113l2/hw_business.c b/ba400_a113l2/hw_business.c
index e682484..2548715 100644
--- a/ba400_a113l2/hw_business.c
+++ b/ba400_a113l2/hw_business.c
@@ -59,6 +59,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/ba400_a113l2/lscript.ld b/ba400_a113l2/lscript.ld
index 69bded4..1e45aa2 100644
--- a/ba400_a113l2/lscript.ld
+++ b/ba400_a113l2/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/ba409_a113l2/hw_business.c b/ba409_a113l2/hw_business.c
index e682484..2548715 100644
--- a/ba409_a113l2/hw_business.c
+++ b/ba409_a113l2/hw_business.c
@@ -59,6 +59,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/ba409_a113l2/lscript.ld b/ba409_a113l2/lscript.ld
index 69bded4..1e45aa2 100644
--- a/ba409_a113l2/lscript.ld
+++ b/ba409_a113l2/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/bc302_t968d4/hw_business.c b/bc302_t968d4/hw_business.c
index 7a8b7a7..c82f088 100644
--- a/bc302_t968d4/hw_business.c
+++ b/bc302_t968d4/hw_business.c
@@ -60,6 +60,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	vMbInit();
 	vCecCallbackInit(CEC_CHIP_T3X);
 	vRtcInit();
diff --git a/bc302_t968d4/lscript.ld b/bc302_t968d4/lscript.ld
index 69bded4..1e45aa2 100644
--- a/bc302_t968d4/lscript.ld
+++ b/bc302_t968d4/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/bc309_t968d4/hw_business.c b/bc309_t968d4/hw_business.c
index 7a8b7a7..c82f088 100644
--- a/bc309_t968d4/hw_business.c
+++ b/bc309_t968d4/hw_business.c
@@ -60,6 +60,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	vMbInit();
 	vCecCallbackInit(CEC_CHIP_T3X);
 	vRtcInit();
diff --git a/bc309_t968d4/lscript.ld b/bc309_t968d4/lscript.ld
index 69bded4..1e45aa2 100644
--- a/bc309_t968d4/lscript.ld
+++ b/bc309_t968d4/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/bg201_s805c1/hw_business.c b/bg201_s805c1/hw_business.c
index 1945058..834dc7a 100644
--- a/bg201_s805c1/hw_business.c
+++ b/bg201_s805c1/hw_business.c
@@ -60,6 +60,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/bg201_s805c1/lscript.ld b/bg201_s805c1/lscript.ld
index 07b4a1d..82c4a92 100644
--- a/bg201_s805c1/lscript.ld
+++ b/bg201_s805c1/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/bg209_s805c1/hw_business.c b/bg209_s805c1/hw_business.c
index 1945058..834dc7a 100644
--- a/bg209_s805c1/hw_business.c
+++ b/bg209_s805c1/hw_business.c
@@ -60,6 +60,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/bg209_s805c1/lscript.ld b/bg209_s805c1/lscript.ld
index 07b4a1d..82c4a92 100644
--- a/bg209_s805c1/lscript.ld
+++ b/bg209_s805c1/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram
diff --git a/t3x_sky/hw_business.c b/t3x_sky/hw_business.c
index 5e70463..f502558 100644
--- a/t3x_sky/hw_business.c
+++ b/t3x_sky/hw_business.c
@@ -60,6 +60,7 @@
 	uint8_t i = 0;
 
 	config_eclic_irqs();
+	config_pmp();
 	for (i = 0; i < 4; ++i)
 		printf("AOCPU_IRQ_SEL=0x%x\n", REG32(AOCPU_IRQ_SEL0 + i * 4));
 	vMbInit();
diff --git a/t3x_sky/lscript.ld b/t3x_sky/lscript.ld
index 69bded4..1e45aa2 100644
--- a/t3x_sky/lscript.ld
+++ b/t3x_sky/lscript.ld
@@ -21,7 +21,7 @@
  PROVIDE( _text = . );
  *(.init)
         *(.text* .rodata*)
-        . = ALIGN(0x100);
+        . = ALIGN(0x400);
         PROVIDE( _etext = . );
  *(.vtable)
     } > ram