Merge "platform: msm_shared: Remove static keyword for read_der_message_length()" into lk.lnx.1.0-dev.1.0
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 02b0bd3..7e83bc3 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -1304,12 +1304,30 @@
return -1;
}
+ /* Its Error if, dt_hdr_size (table->num_entries * dt_entry size + Dev_Tree Header)
+ goes beyound hdr->dt_size*/
+ if (dt_hdr_size > ROUND_TO_PAGE(hdr->dt_size,hdr->page_size)) {
+ dprintf(CRITICAL, "ERROR: Invalid Device Tree size \n");
+ return -1;
+ }
+
/* Find index of device tree within device tree table */
if(dev_tree_get_entry_info(table, &dt_entry) != 0){
dprintf(CRITICAL, "ERROR: Getting device tree address failed\n");
return -1;
}
+ if(dt_entry.offset > (UINT_MAX - dt_entry.size)) {
+ dprintf(CRITICAL, "ERROR: Device tree contents are Invalid\n");
+ return -1;
+ }
+
+ /* Ensure we are not overshooting dt_size with the dt_entry selected */
+ if ((dt_entry.offset + dt_entry.size) > hdr->dt_size) {
+ dprintf(CRITICAL, "ERROR: Device tree contents are Invalid\n");
+ return -1;
+ }
+
if (is_gzip_package((unsigned char *)dt_table_offset + dt_entry.offset, dt_entry.size))
{
unsigned int compressed_size = 0;
@@ -1628,6 +1646,13 @@
return -1;
}
+ /* Its Error if, dt_hdr_size (table->num_entries * dt_entry size + Dev_Tree Header)
+ goes beyound hdr->dt_size*/
+ if (dt_hdr_size > ROUND_TO_PAGE(hdr->dt_size,hdr->page_size)) {
+ dprintf(CRITICAL, "ERROR: Invalid Device Tree size \n");
+ return -1;
+ }
+
table = (struct dt_table*) memalign(CACHE_LINE, dt_hdr_size);
if (!table)
return -1;
@@ -2121,6 +2146,14 @@
dprintf(CRITICAL, "ERROR: Cannot validate Device Tree Table \n");
return -1;
}
+
+ /* Its Error if, dt_hdr_size (table->num_entries * dt_entry size + Dev_Tree Header)
+ goes beyound hdr->dt_size*/
+ if (dt_hdr_size > ROUND_TO_PAGE(hdr->dt_size,hdr->page_size)) {
+ dprintf(CRITICAL, "ERROR: Invalid Device Tree size \n");
+ return -1;
+ }
+
/* Find index of device tree within device tree table */
if(dev_tree_get_entry_info(table, &dt_entry) != 0){
dprintf(CRITICAL, "ERROR: Getting device tree address failed\n");
@@ -2187,17 +2220,22 @@
unsigned int kernel_size = 0;
unsigned int scratch_offset = 0;
+#if FBCON_DISPLAY_MSG
+ /* Exit keys' detection thread firstly */
+ exit_menu_keys_detection();
+#endif
+
#if VERIFIED_BOOT
if(target_build_variant_user() && !device.is_unlocked)
{
fastboot_fail("unlock device to use this command");
- return;
+ goto boot_failed;
}
#endif
if (sz < sizeof(hdr)) {
fastboot_fail("invalid bootimage header");
- return;
+ goto boot_failed;
}
hdr = (struct boot_img_hdr *)data;
@@ -2226,7 +2264,7 @@
/* sz should have atleast raw boot image */
if (image_actual > sz) {
fastboot_fail("bootimage: incomplete or not signed");
- return;
+ goto boot_failed;
}
// Initialize boot state before trying to verify boot.img
@@ -2238,7 +2276,7 @@
if ((target_get_max_flash_size() - (image_actual - sig_actual)) < page_size)
{
fastboot_fail("booimage: size is greater than boot image buffer can hold");
- return;
+ goto boot_failed;
}
#endif
@@ -2266,7 +2304,7 @@
mdtp_activated(&is_mdtp_activated);
if(is_mdtp_activated){
dprintf(CRITICAL, "fastboot boot command is not available.\n");
- return;
+ goto boot_failed;
}
#endif /* MDTP_SUPPORT */
@@ -2324,7 +2362,7 @@
check_aboot_addr_range_overlap(hdr->ramdisk_addr, ramdisk_actual))
{
dprintf(CRITICAL, "kernel/ramdisk addresses overlap with aboot addresses.\n");
- return;
+ goto boot_failed;
}
#if DEVICE_TREE
@@ -2337,7 +2375,7 @@
if (check_aboot_addr_range_overlap(hdr->tags_addr, MAX_TAGS_SIZE))
{
dprintf(CRITICAL, "Tags addresses overlap with aboot addresses.\n");
- return;
+ goto boot_failed;
}
#endif
@@ -2349,7 +2387,7 @@
if (check_aboot_addr_range_overlap(hdr->tags_addr, kernel_actual))
{
dprintf(CRITICAL, "Tags addresses overlap with aboot addresses.\n");
- return;
+ goto boot_failed;
}
/*
@@ -2365,7 +2403,7 @@
(void *)hdr->tags_addr);
if (!dtb) {
fastboot_fail("dtb not found");
- return;
+ goto boot_failed;
}
}
#endif
@@ -2376,6 +2414,15 @@
boot_linux((void*) hdr->kernel_addr, (void*) hdr->tags_addr,
(const char*) hdr->cmdline, board_machtype(),
(void*) hdr->ramdisk_addr, hdr->ramdisk_size);
+
+ /* fastboot already stop, it's no need to show fastboot menu */
+ return;
+boot_failed:
+#if FBCON_DISPLAY_MSG
+ /* revert to fastboot menu if boot failed */
+ display_fastboot_menu();
+#endif
+ return;
}
void cmd_erase_nand(const char *arg, void *data, unsigned sz)
diff --git a/dev/gcdb/display/include/panel_sharp_wqxga_dualdsi_video.h b/dev/gcdb/display/include/panel_sharp_wqxga_dualdsi_video.h
index f317ed3..eb56bbf 100644
--- a/dev/gcdb/display/include/panel_sharp_wqxga_dualdsi_video.h
+++ b/dev/gcdb/display/include/panel_sharp_wqxga_dualdsi_video.h
@@ -163,7 +163,7 @@
/* Dynamic fps supported frequencies by panel */
/*---------------------------------------------------------------------------*/
static const struct dfps_panel_info sharp_wqxga_dualdsi_video_dfps = {
- 1, 8, {53, 54, 55, 56, 57, 58, 59, 60}
+ 1, 9, {48, 53, 54, 55, 56, 57, 58, 59, 60}
};
/* 2LM + 2CTL */
diff --git a/dev/gcdb/display/include/panel_truly_720p_cmd.h b/dev/gcdb/display/include/panel_truly_720p_cmd.h
index 3fcc9cb..231f041 100644
--- a/dev/gcdb/display/include/panel_truly_720p_cmd.h
+++ b/dev/gcdb/display/include/panel_truly_720p_cmd.h
@@ -78,8 +78,8 @@
static char truly_720p_cmd_on_cmd4[] = {
0x06, 0x00, 0x29, 0xc0,
-0xbd, 0x02, 0xb0, 0x1e,
-0x1e, 0x00, 0xff, 0xff, };
+0xbd, 0x02, 0x67, 0x20,
+0x20, 0x00, 0xff, 0xff, };
static char truly_720p_cmd_on_cmd5[] = {
0x0b, 0x00, 0x29, 0xc0,
diff --git a/platform/msm_shared/dev_tree.c b/platform/msm_shared/dev_tree.c
index 5cd6576..f120927 100755
--- a/platform/msm_shared/dev_tree.c
+++ b/platform/msm_shared/dev_tree.c
@@ -1269,6 +1269,12 @@
return ret;
}
+ if (check_aboot_addr_range_overlap((uint32_t)fdt,
+ (fdt_totalsize(fdt) + DTB_PAD_SIZE))) {
+ dprintf(CRITICAL, "Error: Fdt addresses overlap with aboot addresses.\n");
+ return ret;
+ }
+
/* Add padding to make space for new nodes and properties. */
ret = fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + DTB_PAD_SIZE);
if (ret!= 0)
diff --git a/platform/msm_shared/rpmb/rpmb.c b/platform/msm_shared/rpmb/rpmb.c
index 3c85b8d..dd7b85f 100644
--- a/platform/msm_shared/rpmb/rpmb.c
+++ b/platform/msm_shared/rpmb/rpmb.c
@@ -54,8 +54,9 @@
info.size = mmc_dev->card.rpmb_size / RPMB_MIN_BLK_SZ;
if (mmc_dev->card.ext_csd[MMC_EXT_CSD_REV] < 8)
{
+ //as per emmc spec rel_wr_count should be 1 for emmc version < 5.1
dprintf(SPEW, "EMMC Version < 5.1\n");
- info.rel_wr_count = mmc_dev->card.rel_wr_count;
+ info.rel_wr_count = 1;
}
else
{
diff --git a/target/msm8996/target_display.c b/target/msm8996/target_display.c
index 439ec14..69f362e 100644
--- a/target/msm8996/target_display.c
+++ b/target/msm8996/target_display.c
@@ -1,4 +1,4 @@
-/* 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
@@ -274,6 +274,8 @@
uint32_t flags, dsi_phy_pll_out;
uint32_t ret = NO_ERROR;
uint32_t board_version = board_soc_version();
+ uint32_t board_hw_id = board_hardware_id();
+ bool video_core_enable = false;
struct dfps_pll_codes *pll_codes = &pinfo->mipi.pll_codes;
if (pinfo->dest == DISPLAY_2) {
@@ -286,6 +288,10 @@
flags |= MMSS_DSI_CLKS_FLAG_DSI1;
}
+ /* only required for msm8996 v2 and v2.1 revision */
+ video_core_enable = (board_version == 0x20000 || board_version == 0x20001) &&
+ !(board_hw_id == MSM8996SG || board_hw_id == APQ8096SG);
+
if (!enable) {
/* stop pll */
writel(0x0, pinfo->mipi.phy_base + 0x48);
@@ -295,7 +301,7 @@
goto clks_disable;
}
- if (board_version == 0x20000 || board_version == 0x20001)
+ if (video_core_enable)
video_gdsc_enable();
mmss_gdsc_enable();
mmss_bus_clock_enable();
@@ -328,7 +334,7 @@
mdp_clock_disable();
mmss_bus_clock_disable();
mmss_gdsc_disable();
- if (board_version == 0x20000 || board_version == 0x20001)
+ if (video_core_enable)
video_gdsc_disable();
return ret;