fix(lib/s2tt): allow rtt fold till level 1

Allow RMI_RTT_FOLD of Level 2 Assigned RTTs.
Disallow RMI_RTT_FOLD after Level 2 for Assigned NS RTTs.
Note that UNASSIGNED and UNASSIGNED_NS Rtts can be folded
till min block level allowed by Architecture.

Change-Id: I494835b479542529973edb7f253a079d2aced07d
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
diff --git a/lib/s2tt/include/s2tt.h b/lib/s2tt/include/s2tt.h
index 42347e8..27d47e7 100644
--- a/lib/s2tt/include/s2tt.h
+++ b/lib/s2tt/include/s2tt.h
@@ -47,7 +47,7 @@
 #define S2TT_MIN_STARTING_LEVEL		(0)
 #define S2TT_MIN_STARTING_LEVEL_LPA2	(-1)
 #define S2TT_PAGE_LEVEL			(3)
-#define S2TT_MIN_BLOCK_LEVEL		(2)
+#define S2TT_MIN_BLOCK_LEVEL		(1)
 
 /*
  * S2TTE_STRIDE: The number of bits resolved in a single level of translation
diff --git a/lib/s2tt/src/s2tt.c b/lib/s2tt/src/s2tt.c
index 19dffba..754d912 100644
--- a/lib/s2tt/src/s2tt.c
+++ b/lib/s2tt/src/s2tt.c
@@ -752,9 +752,9 @@
 
 	desc_type = s2tte & S2TT_DESC_TYPE_MASK;
 
-	/* Only pages at L3 and valid blocks at L2 allowed */
+	/* Only pages at L3 and valid blocks at L2 and L1 allowed */
 	if (((level == S2TT_PAGE_LEVEL) && (desc_type == S2TTE_L3_PAGE)) ||
-	    ((level == S2TT_MIN_BLOCK_LEVEL) && (desc_type == S2TTE_L012_BLOCK))) {
+	    ((level >= S2TT_MIN_BLOCK_LEVEL) && (desc_type == S2TTE_L012_BLOCK))) {
 		return true;
 	}