Merge "platform: msm8953: add function to detect platform" into lk.lnx.1.0-dev.1.0
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 5f1b5ff..7564319 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -2521,7 +2521,7 @@
 					fastboot_fail("unlock device to flash keystore");
 					return;
 				}
-				if(!boot_verify_validate_keystore((unsigned char *)data))
+				if(!boot_verify_validate_keystore((unsigned char *)data,sz))
 				{
 					fastboot_fail("image is not a keystore file");
 					return;
diff --git a/platform/msm_shared/boot_verifier.c b/platform/msm_shared/boot_verifier.c
index 9c80839..12488a9 100644
--- a/platform/msm_shared/boot_verifier.c
+++ b/platform/msm_shared/boot_verifier.c
@@ -96,14 +96,14 @@
 	} ASN1_SEQUENCE_END(KEYSTORE)
 IMPLEMENT_ASN1_FUNCTIONS(KEYSTORE)
 
-static uint32_t read_der_message_length(unsigned char* input)
+static uint32_t read_der_message_length(unsigned char* input, unsigned sz)
 {
 	uint32_t len = 0;
-	int pos = 0;
+	uint32_t pos = 0;
 	uint8_t len_bytes = 1;
 
 	/* Check if input starts with Sequence id (0X30) */
-	if(input[pos] != 0x30)
+	if(sz < 3 || input[pos] != 0x30)
 		return len;
 	pos++;
 
@@ -132,7 +132,7 @@
 		}
 
 		/* Read next octet */
-		if (pos < (int) ASN1_SIGNATURE_BUFFER_SZ)
+		if (pos < (uint32_t) ASN1_SIGNATURE_BUFFER_SZ && pos < sz)
 			len = len | input[pos];
 		else
 		{
@@ -550,7 +550,7 @@
 
 	/* Copy the signature from scratch memory to buffer */
 	memcpy(signature, sig_addr, ASN1_SIGNATURE_BUFFER_SZ);
-	sig_len = read_der_message_length(signature);
+	sig_len = read_der_message_length(signature, ASN1_SIGNATURE_BUFFER_SZ);
 
 	if(!sig_len)
 	{
@@ -646,12 +646,12 @@
 	}
 }
 
-bool boot_verify_validate_keystore(unsigned char * user_addr)
+bool boot_verify_validate_keystore(unsigned char * user_addr, unsigned sz)
 {
 	bool ret = false;
 	unsigned char *input = user_addr;
 	KEYSTORE *ks = NULL;
-	uint32_t len = read_der_message_length(input);
+	uint32_t len = read_der_message_length(input, sz);
 	if(!len)
 	{
 		dprintf(CRITICAL, "boot_verifier: keystore length is invalid.\n");
diff --git a/platform/msm_shared/include/boot_verifier.h b/platform/msm_shared/include/boot_verifier.h
index c40a435..485cc3c 100644
--- a/platform/msm_shared/include/boot_verifier.h
+++ b/platform/msm_shared/include/boot_verifier.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016, 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
@@ -172,7 +172,7 @@
 /* Print current boot state */
 void boot_verify_print_state();
 /* Function to validate keystore */
-bool boot_verify_validate_keystore(unsigned char * user_addr);
+bool boot_verify_validate_keystore(unsigned char * user_addr, unsigned sz);
 /* Function to send root of trust to trust zone */
 bool send_rot_command(uint32_t is_unlocked);
 unsigned char* get_boot_fingerprint(unsigned int* buf_size);
diff --git a/platform/msm_shared/qgic_v3.c b/platform/msm_shared/qgic_v3.c
index 692801b..7549e3a 100644
--- a/platform/msm_shared/qgic_v3.c
+++ b/platform/msm_shared/qgic_v3.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2015, 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
@@ -77,9 +77,6 @@
 	uint32_t eoimode = 0;
 	uint32_t grpen1 = 0x1;
 
-	/* For cpu init need to wake up the redistributor */
-	writel((readl(GICR_WAKER_CPU0) & ~GIC_WAKER_PROCESSORSLEEP), GICR_WAKER_CPU0);
-
 	/* Wait until redistributor is up */
 	while(readl(GICR_WAKER_CPU0) & GIC_WAKER_CHILDRENASLEEP)
 	{
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index 8ea4a1e..f6bd8d9 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -447,11 +447,16 @@
 	MSM8953  = 293,
 	MSM8937 = 294,
 	APQ8037 = 295,
+	MSM8996L = 302,
 	MSMGOLD = 303,
+	APQ8053 = 304,
+	MSM8996SG = 305,
 	APQGOLD = 307,
 	MSMGOLD2 = 308,
 	MSMGOLD3 = 309,
-	APQ8053 = 304,
+	MSM8996AU = 310,
+	APQ8096AU = 311,
+	APQ8096SG = 312,
 };
 
 enum platform {
diff --git a/target/msm8953/target_display.c b/target/msm8953/target_display.c
index 5f9ac3b..fcd4b0a 100644
--- a/target/msm8953/target_display.c
+++ b/target/msm8953/target_display.c
@@ -390,11 +390,13 @@
 
 	if (!strcmp(oem.panel, NO_PANEL_CONFIG)
 		|| !strcmp(oem.panel, SIM_VIDEO_PANEL)
+		|| !strcmp(oem.panel, SIM_DUALDSI_VIDEO_PANEL)
 		|| !strcmp(oem.panel, SIM_CMD_PANEL)
+		|| !strcmp(oem.panel, SIM_DUALDSI_CMD_PANEL)
 		|| oem.skip) {
 		dprintf(INFO, "Selected panel: %s\nSkip panel configuration\n",
 			oem.panel);
-		return;
+		oem.cont_splash = false;
 	}
 
 	do {
diff --git a/target/msm8996/init.c b/target/msm8996/init.c
index 42a0614..9463dee 100644
--- a/target/msm8996/init.c
+++ b/target/msm8996/init.c
@@ -456,13 +456,15 @@
 	{
 		switch(platform) {
 		case APQ8096:
+		case APQ8096AU:
+		case APQ8096SG:
 			board->baseband = BASEBAND_APQ;
 			break;
 		case MSM8996:
-			if (board->platform_version == 0x10000)
-				board->baseband = BASEBAND_APQ;
-			else
-				board->baseband = BASEBAND_MSM;
+		case MSM8996SG:
+		case MSM8996AU:
+		case MSM8996L:
+			board->baseband = BASEBAND_MSM;
 			break;
 		default:
 			dprintf(CRITICAL, "Platform type: %u is not supported\n",platform);