Merge "include: target: remove macros for old vb runtime naming convention."
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 4fbda79..c04b504 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -363,7 +363,7 @@
 #endif
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
     		boot_state = boot_verify_get_state();
 	}
@@ -391,7 +391,7 @@
 	cmdline_len += strlen(sn_buf);
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		cmdline_len += strlen(verified_state) + strlen(vbsn[boot_state].name);
 		if ((device.verity_mode != 0 ) && (device.verity_mode != 1))
@@ -562,7 +562,7 @@
 		}
 
 #if VERIFIED_BOOT
-		if (VB_V2 == target_get_vb_version())
+		if (VB_M <= target_get_vb_version())
 		{
 			src = verified_state;
 			if(have_cmdline) --dst;
@@ -905,7 +905,7 @@
 	free(final_cmdline);
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		if (device.verity_mode == 0) {
 #if FBCON_DISPLAY_MSG
@@ -1443,7 +1443,7 @@
 #endif
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		/* set boot and system versions. */
 		set_os_version((unsigned char *)image_addr);
@@ -2157,7 +2157,7 @@
 		memcpy(info, dev, sizeof(struct device_info));
 
 #if USE_RPMB_FOR_DEVINFO
-		if (VB_V2 == target_get_vb_version() &&
+		if (VB_M <= target_get_vb_version() &&
 			is_secure_boot_enable()) {
 				if((write_device_info_rpmb((void*) info, PAGE_SIZE)) < 0)
 					ASSERT(0);
@@ -2188,7 +2188,7 @@
 		info_buf = info;
 
 #if USE_RPMB_FOR_DEVINFO
-		if (VB_V2 == target_get_vb_version() &&
+		if (VB_M <= target_get_vb_version() &&
 			is_secure_boot_enable()) {
 				if((read_device_info_rpmb((void*) info, PAGE_SIZE)) < 0)
 					ASSERT(0);
@@ -2205,20 +2205,20 @@
 			if (is_secure_boot_enable()) {
 				info->is_unlocked = 0;
 #if VERIFIED_BOOT
-				if (VB_V2 == target_get_vb_version())
+				if (VB_M <= target_get_vb_version())
 					info->is_unlock_critical = 0;
 #endif
 			} else {
 				info->is_unlocked = 1;
 #if VERIFIED_BOOT
-				if (VB_V2 == target_get_vb_version())
+				if (VB_M <= target_get_vb_version())
 					info->is_unlock_critical = 1;
 #endif
 			}
 			info->is_tampered = 0;
 			info->charger_screen_enabled = 0;
 #if VERIFIED_BOOT
-			if (VB_V2 == target_get_vb_version())
+			if (VB_M <= target_get_vb_version())
 				info->verity_mode = 1; //enforcing by default
 #endif
 			write_device_info(info);
@@ -2259,7 +2259,7 @@
 	if (type == UNLOCK)
 		device.is_unlocked = status;
 #if VERIFIED_BOOT
-	else if (VB_V2 == target_get_vb_version() &&
+	else if (VB_M <= target_get_vb_version() &&
 			type == UNLOCK_CRITICAL)
 			device.is_unlock_critical = status;
 #endif
@@ -2275,7 +2275,7 @@
 	if (type == UNLOCK)
 		is_unlocked = device.is_unlocked;
 #if VERIFIED_BOOT
-	if(VB_V2 == target_get_vb_version() &&
+	if(VB_M <= target_get_vb_version() &&
 		type == UNLOCK_CRITICAL)
 	{
 			is_unlocked = device.is_unlock_critical;
@@ -2562,7 +2562,7 @@
 #endif /* MDTP_SUPPORT */
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		/* set boot and system versions. */
 		set_os_version((unsigned char *)data);
@@ -2776,7 +2776,7 @@
 		}
 	}
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version() &&
+	if (VB_M <= target_get_vb_version() &&
 		!(strncmp(arg, "userdata", 8)) &&
 		send_delete_keys_to_tz())
 			ASSERT(0);
@@ -2951,7 +2951,7 @@
 			return;
 		}
 
-		if (VB_V2 == target_get_vb_version() &&
+		if (VB_M <= target_get_vb_version() &&
 			!device.is_unlock_critical) 
 		{
 			fastboot_fail("Device is critical locked, Meta image flashing is not allowed");
@@ -3363,7 +3363,7 @@
 		 * common partition will allow to be flashed
 		 * critical partition will not allow to flash image.
 		 */
-		if (VB_V2 == target_get_vb_version() &&
+		if (VB_M <= target_get_vb_version() &&
 			!device.is_unlock_critical &&
 			critical_flash_allowed(arg)) {
 				fastboot_fail("Critical partition flashing is not allowed");
@@ -3382,7 +3382,7 @@
 		cmd_flash_mmc_img(arg, data, sz);
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version() &&
+	if (VB_M <= target_get_vb_version() &&
 		(!strncmp(arg, "system", 6)) &&
 		!device.verity_mode)
 		// reset dm_verity mode to enforcing
@@ -3728,7 +3728,7 @@
 	snprintf(response, sizeof(response), "\tDevice unlocked: %s", (device.is_unlocked ? "true" : "false"));
 	fastboot_info(response);
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		snprintf(response, sizeof(response), "\tDevice critical unlocked: %s",
 					(device.is_unlock_critical ? "true" : "false"));
@@ -4381,7 +4381,7 @@
 		boot_reason_alarm = true;
 	}
 #if VERIFIED_BOOT
-	else if (VB_V2 == target_get_vb_version())
+	else if (VB_M <= target_get_vb_version())
 	{
 		if (reboot_mode == DM_VERITY_ENFORCING)
 		{
diff --git a/include/target.h b/include/target.h
index 772c424..7b92dfb 100644
--- a/include/target.h
+++ b/include/target.h
@@ -31,8 +31,8 @@
 /* Enum for target VB version detection */
 enum
 {
-	VB_V1 = 1,
-	VB_V2 = 2,
+	VB_L = 1,
+	VB_M = 2,
 };
 
 /* Target helper functions exposed to USB driver */
diff --git a/target/init.c b/target/init.c
index fed33cc..57ef22f 100644
--- a/target/init.c
+++ b/target/init.c
@@ -299,14 +299,13 @@
 {
 	if (vb_version == INVALID)
 	{
-		/* check vb version on first time. */
-		/* Incase of keymaster present, its VB2.0 */
+		/* Incase of keymaster present,verified boot for M version */
 		if (partition_get_index("keymaster") != INVALID_PTN)
-			vb_version = VB_V2;
+			vb_version = VB_M;
 		else
 		/* Incase keymaster is not present,
 		we use keystore for verification. */
-			vb_version = VB_V1;
+			vb_version = VB_L;
 	}
 	return vb_version;
 }
diff --git a/target/msm8909/init.c b/target/msm8909/init.c
index 790dabb..4a5a3db 100644
--- a/target/msm8909/init.c
+++ b/target/msm8909/init.c
@@ -388,7 +388,7 @@
 		target_crypto_init_params();
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		clock_ce_enable(CE1_INSTANCE);
 
@@ -706,7 +706,7 @@
 		clock_ce_disable(CE1_INSTANCE);
 
 #if VERIFIED_BOOT
-	if(VB_V2 == target_get_vb_version())
+	if(VB_M <= target_get_vb_version())
 	{
 		if (is_sec_app_loaded())
 		{
diff --git a/target/msm8952/init.c b/target/msm8952/init.c
index 2c96f67..f11a4c9 100644
--- a/target/msm8952/init.c
+++ b/target/msm8952/init.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -332,7 +332,7 @@
 		target_crypto_init_params();
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		clock_ce_enable(CE1_INSTANCE);
 
@@ -571,7 +571,7 @@
 		clock_ce_disable(CE1_INSTANCE);
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		if (is_sec_app_loaded())
 		{
diff --git a/target/msm8953/init.c b/target/msm8953/init.c
index 159279d..8b4a48b 100644
--- a/target/msm8953/init.c
+++ b/target/msm8953/init.c
@@ -286,7 +286,7 @@
 		target_crypto_init_params();
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		clock_ce_enable(CE1_INSTANCE);
 
@@ -420,7 +420,7 @@
 		clock_ce_disable(CE1_INSTANCE);
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		if (is_sec_app_loaded())
 		{
diff --git a/target/msm8996/init.c b/target/msm8996/init.c
index 4e9825e..0293764 100644
--- a/target/msm8996/init.c
+++ b/target/msm8996/init.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -180,7 +180,7 @@
 	}
 
 #if VERIFIED_BOOT
-	if (target_get_vb_version() == VB_V2 &&
+	if (target_get_vb_version() >= VB_M &&
 		is_sec_app_loaded())
 	{
 		if (send_milestone_call_to_tz() < 0)
@@ -207,7 +207,7 @@
 	rpm_glink_uninit();
 
 #if VERIFIED_BOOT
-	if (target_get_vb_version() == VB_V2)
+	if (target_get_vb_version() >= VB_M)
 	{
 		if (rpmb_uninit() < 0)
 		{
@@ -405,7 +405,7 @@
 #endif
 
 #if VERIFIED_BOOT
-	if (VB_V2 == target_get_vb_version())
+	if (VB_M <= target_get_vb_version())
 	{
 		/* Initialize Qseecom */
 		if (qseecom_init() < 0)