Merge 0b17ba29d4d8178198139b8b1e073846f08b90bf on remote branch
Change-Id: Ic66f1ea62681e25a14d795272f70e78b77698071
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 584ba35..a2662c7 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -210,6 +210,9 @@
#define MAX_DTBO_IDX_STR 64
static const char *android_boot_dtbo_idx = " androidboot.dtbo_idx=";
+
+#define MAX_DTB_IDX_STR MAX_DTBO_IDX_STR
+static const char *android_boot_dtb_idx = " androidboot.dtb_idx=";
#endif
#if VERIFIED_BOOT
@@ -453,6 +456,8 @@
int syspath_buflen = strlen(sys_path) + sizeof(int) + 2; /*allocate buflen for largest possible string*/
char dtbo_idx_str[MAX_DTBO_IDX_STR] = "\0";
int dtbo_idx = INVALID_PTN;
+ char dtb_idx_str[MAX_DTB_IDX_STR] = "\0";
+ int dtb_idx = INVALID_PTN;
#endif
char syspath_buf[syspath_buflen];
#if HIBERNATION_SUPPORT
@@ -712,6 +717,13 @@
android_boot_dtbo_idx, dtbo_idx);
cmdline_len += strlen (dtbo_idx_str);
}
+
+ dtb_idx = get_dtb_idx ();
+ if (dtb_idx != INVALID_PTN) {
+ snprintf(dtb_idx_str, sizeof(dtb_idx_str), "%s%d",
+ android_boot_dtb_idx, dtb_idx);
+ cmdline_len += strlen (dtb_idx_str);
+ }
#endif
if (cmdline_len > 0) {
@@ -992,6 +1004,12 @@
--dst;
while ((*dst++ = *src++));
}
+
+ if (dtb_idx != INVALID_PTN) {
+ src = dtb_idx_str;
+ --dst;
+ while ((*dst++ = *src++));
+ }
#endif
}
@@ -1136,7 +1154,7 @@
generate_atags(tags, final_cmdline, ramdisk, ramdisk_size);
#endif
-#if VERIFIED_BOOT || VERIFIED_BOOT_2
+#if VERIFIED_BOOT
if (VB_M <= target_get_vb_version())
{
if (device.verity_mode == 0) {
@@ -1476,8 +1494,11 @@
unsigned ramdisk_actual;
unsigned imagesize_actual;
unsigned second_actual = 0;
+ void * image_buf = NULL;
unsigned int dtb_size = 0;
+ unsigned dtb_image_size = 0;
+ uint32_t dtb_image_offset = 0;
unsigned int out_len = 0;
unsigned int out_avai_len = 0;
unsigned char *out_addr = NULL;
@@ -1601,6 +1622,7 @@
}
imagesize_actual = (page_size + kernel_actual + ramdisk_actual + second_actual);
#endif
+ dtb_image_size = hdr->kernel_size;
#ifdef OSVERSION_IN_BOOTIMAGE
/* If header version is ONE and booting into recovery,
@@ -1660,8 +1682,32 @@
dprintf(SPEW, "Recovery Dtbo Offset 0x%llx\n", hdr1->recovery_dtbo_offset);
}
+
+ if ( hdr->header_version == BOOT_HEADER_VERSION_TWO) {
+ struct boot_img_hdr_v1 *hdr1 =
+ (struct boot_img_hdr_v1 *) (image_addr + sizeof(boot_img_hdr));
+ struct boot_img_hdr_v2 *hdr2 = (struct boot_img_hdr_v2 *)
+ (image_addr + sizeof(boot_img_hdr) +
+ BOOT_IMAGE_HEADER_V2_OFFSET);
+ unsigned int recovery_dtbo_actual = 0;
+
+ recovery_dtbo_actual =
+ ROUND_TO_PAGE(hdr1->recovery_dtbo_size, page_mask);
+ imagesize_actual += recovery_dtbo_actual;
+
+ imagesize_actual += ROUND_TO_PAGE(hdr2->dtb_size, page_mask);
+
+
+ dtb_image_offset = page_size + patched_kernel_hdr_size +
+ kernel_actual + ramdisk_actual + second_actual +
+ recovery_dtbo_actual;
+
+ dprintf(SPEW, "Header version: %d\n", hdr->header_version);
+ dprintf(SPEW, "Dtb image offset 0x%x\n", dtb_image_offset);
+ }
#endif
+
/* Validate the boot/recovery image size is within the bounds of partition size */
if (imagesize_actual > image_size) {
dprintf(CRITICAL, "Image size is greater than partition size.\n");
@@ -2047,10 +2093,18 @@
* In case of dtbo, this API is going to read dtbo on scratch.
*/
void *dtb;
- dtb = dev_tree_appended(
- (void*)(image_addr + page_size +
- patched_kernel_hdr_size),
- hdr->kernel_size, dtb_offset,
+ image_buf = (void*)(image_addr + page_size + patched_kernel_hdr_size);
+
+#ifdef OSVERSION_IN_BOOTIMAGE
+ if ( hdr->header_version == BOOT_HEADER_VERSION_TWO) {
+
+ image_buf = (void*)(image_addr);
+ dtb_offset = dtb_image_offset;
+ dtb_image_size = imagesize_actual;
+ }
+#endif
+
+ dtb = dev_tree_appended(image_buf, dtb_image_size, dtb_offset,
(void *)hdr->tags_addr);
if (!dtb) {
dprintf(CRITICAL, "ERROR: Appended Device Tree Blob not found\n");
@@ -4401,7 +4455,7 @@
if (current_slot_suffix &&
!strncmp(p, current_slot_suffix, strlen(current_slot_suffix)))
{
- partition_switch_slots(current_active_slot, i);
+ partition_switch_slots(current_active_slot, i, true);
publish_getvar_multislot_vars();
fastboot_okay("");
return;
@@ -5007,8 +5061,14 @@
publish_getvar_multislot_vars();
/* Max download size supported */
+#if !VERIFIED_BOOT_2
snprintf(max_download_size, MAX_RSP_SIZE, "\t0x%x",
target_get_max_flash_size());
+#else
+ snprintf(max_download_size, MAX_RSP_SIZE, "\t0x%x",
+ SUB_SALT_BUFF_OFFSET(target_get_max_flash_size()));
+#endif
+
fastboot_publish("max-download-size", (const char *) max_download_size);
/* Is the charger screen check enabled */
snprintf(charger_screen_enabled, MAX_RSP_SIZE, "%d",
diff --git a/app/aboot/bootimg.h b/app/aboot/bootimg.h
index a07db93..1ad5a64 100644
--- a/app/aboot/bootimg.h
+++ b/app/aboot/bootimg.h
@@ -2,7 +2,7 @@
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
- * Copyright (c) 2014,2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014,2016,2019 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
@@ -154,6 +154,50 @@
* else: jump to kernel_addr
*/
+#define BOOT_IMAGE_HEADER_V2_OFFSET sizeof (struct boot_img_hdr_v1)
+#define BOOT_HEADER_VERSION_TWO 2
+
+struct boot_img_hdr_v2 {
+ uint32_t dtb_size; /* size in bytes for DTB image */
+ uint64_t dtb_addr; /* physical load address for DTB image */
+} __attribute__((packed));
+
+/* When the boot image header has a version of BOOT_HEADER_VERSION_TWO,
+ * the structure of the boot image is as follows:
+ *
+ * +-----------------+
+ * | boot header | 1 page
+ * +-----------------+
+ * | kernel | n pages
+ * +-----------------+
+ * | ramdisk | m pages
+ * +-----------------+
+ * | second stage | o pages
+ * +-----------------+
+ * | recovery dtbo | p pages
+ * +-----------------+
+ * | dtb.img | q pages
+ * +-----------------+
+ * n = (kernel_size + page_size - 1) / page_size
+ * m = (ramdisk_size + page_size - 1) / page_size
+ * o = (second_size + page_size - 1) / page_size
+ * p = (recovery_dtbo_size + page_size - 1) / page_size
+ * q = (dtb_size + page_size - 1) / page_size
+ *
+ * 0. all entities are page_size aligned in flash
+ * 1. kernel and ramdisk are required (size != 0)
+ * 2. recovery_dtbo is required for recovery.img
+ * in non-A/B devices(recovery_dtbo_size != 0)
+ * 3. second is optional (second_size == 0 -> no second)
+ * 4. load each element (kernel, ramdisk, second, recovery_dtbo) at
+ * the specified physical address (kernel_addr, etc)
+ * 5. prepare tags at tag_addr. kernel_args[] is
+ * appended to the kernel commandline in the tags.
+ * 6. r0 = 0, r1 = MACHINE_TYPE, r2 = tags_addr
+ * 7. if second_size != 0: jump to second_addr
+ * else: jump to kernel_addr
+ */
+
boot_img_hdr *mkbootimg(void *kernel, unsigned kernel_size,
void *ramdisk, unsigned ramdisk_size,
void *second, unsigned second_size,
diff --git a/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h b/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h
index 3199619..5583e53 100644
--- a/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h
+++ b/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h
@@ -158,7 +158,7 @@
/* Command mode panel information */
/*---------------------------------------------------------------------------*/
static struct commandpanel_info edo_rm67162_qvga_cmd_command_panel = {
- 1, 1, 1, 0, 0, 0x2c, 0, 0, 0, 1, 0, 0
+ 1, 1, 1, 1, 2, 0x2c, 0, 0, 0, 1, 0, 0
};
/*---------------------------------------------------------------------------*/
diff --git a/dev/gcdb/display/include/panel_truly_rm69090_qvga_cmd.h b/dev/gcdb/display/include/panel_truly_rm69090_qvga_cmd.h
new file mode 100755
index 0000000..5ee4cc6
--- /dev/null
+++ b/dev/gcdb/display/include/panel_truly_rm69090_qvga_cmd.h
@@ -0,0 +1,192 @@
+/* Copyright (c) 2019, 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
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PANEL_TRULY_RM69090_QVGA_CMD_H_
+#define _PANEL_TRULY_RM69090_QVGA_CMD_H_
+/*---------------------------------------------------------------------------*/
+/* HEADER files */
+/*---------------------------------------------------------------------------*/
+#include "panel.h"
+
+/*---------------------------------------------------------------------------*/
+/* Panel configuration */
+/*---------------------------------------------------------------------------*/
+static struct panel_config truly_rm69090_qvga_cmd_panel_data = {
+ "qcom,mdss_dsi_truly_rm69090_qvga_cmd", "dsi:0:", "qcom,mdss-dsi-panel",
+ 10, 1, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel resolution */
+/*---------------------------------------------------------------------------*/
+static struct panel_resolution truly_rm69090_qvga_cmd_panel_res = {
+ 368, 448, 40, 20, 2, 0, 6, 8, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel color information */
+/*---------------------------------------------------------------------------*/
+static struct color_info truly_rm69090_qvga_cmd_color = {
+ 24, 0, 0xff, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel on/off command information */
+/*---------------------------------------------------------------------------*/
+static char truly_rm69090_qvga_cmd_on_cmd0[] = {
+ 0xFE, 0x01, 0x15, 0x80
+};
+
+static char truly_rm69090_qvga_cmd_on_cmd1[] = {
+ 0x6A, 0x03, 0x15, 0x80
+};
+
+static char truly_rm69090_qvga_cmd_on_cmd2[] = {
+ 0xFE, 0x00, 0x15, 0x80
+};
+
+static char truly_rm69090_qvga_cmd_on_cmd3[] = {
+ 0x35, 0x00, 0x15, 0x80
+};
+
+static char truly_rm69090_qvga_cmd_on_cmd4[] = {
+ 0x53, 0x20, 0x15, 0x80
+};
+
+static char truly_rm69090_qvga_cmd_on_cmd5[] = {
+ 0x51, 0x80, 0x15, 0x80
+};
+
+static char truly_rm69090_qvga_cmd_on_cmd6[] = {
+ 0x05, 0x00, 0x39, 0xC0,
+ 0x2A, 0x00, 0x10, 0x01,
+ 0x7F, 0xFF, 0xFF, 0xFF,
+};
+
+static char truly_rm69090_qvga_cmd_on_cmd7[] = {
+ 0x05, 0x00, 0x39, 0xC0,
+ 0x2B, 0x00, 0x00, 0x01,
+ 0xBF, 0xFF, 0xFF, 0xFF,
+};
+
+static char truly_rm69090_qvga_cmd_on_cmd8[] = {
+ 0x11, 0x00, 0x05, 0x80
+};
+
+static char truly_rm69090_qvga_cmd_on_cmd9[] = {
+ 0x29, 0x00, 0x05, 0x80
+};
+
+static struct mipi_dsi_cmd truly_rm69090_qvga_cmd_on_command[] = {
+ {0x4, truly_rm69090_qvga_cmd_on_cmd0, 0x00},
+ {0x4, truly_rm69090_qvga_cmd_on_cmd1, 0x00},
+ {0x4, truly_rm69090_qvga_cmd_on_cmd2, 0x00},
+ {0x4, truly_rm69090_qvga_cmd_on_cmd3, 0x00},
+ {0x4, truly_rm69090_qvga_cmd_on_cmd4, 0x00},
+ {0x4, truly_rm69090_qvga_cmd_on_cmd5, 0x00},
+ {0xc, truly_rm69090_qvga_cmd_on_cmd6, 0x00},
+ {0xc, truly_rm69090_qvga_cmd_on_cmd7, 0x00},
+ {0x4, truly_rm69090_qvga_cmd_on_cmd8, 0x78},
+ {0x4, truly_rm69090_qvga_cmd_on_cmd9, 0x40}
+};
+
+#define TRULY_RM69090_QVGA_CMD_ON_COMMAND 10
+
+
+static char truly_rm69090_qvga_cmdoff_cmd0[] = {
+ 0x28, 0x00, 0x05, 0x80
+};
+
+static char truly_rm69090_qvga_cmdoff_cmd1[] = {
+ 0x10, 0x00, 0x05, 0x80
+};
+
+static char truly_rm69090_qvga_cmdoff_cmd2[] = {
+ 0x4F, 0x01, 0x15, 0x80
+};
+
+static struct mipi_dsi_cmd truly_rm69090_qvga_cmd_off_command[] = {
+ {0x4, truly_rm69090_qvga_cmdoff_cmd0, 0x28},
+ {0x4, truly_rm69090_qvga_cmdoff_cmd1, 0x78},
+ {0x4, truly_rm69090_qvga_cmdoff_cmd2, 0x00}
+};
+
+#define TRULY_RM69090_QVGA_CMD_OFF_COMMAND 3
+
+
+static struct command_state truly_rm69090_qvga_cmd_state = {
+ 0, 1
+};
+
+/*---------------------------------------------------------------------------*/
+/* Command mode panel information */
+/*---------------------------------------------------------------------------*/
+static struct commandpanel_info truly_rm69090_qvga_cmd_command_panel = {
+ 1, 1, 1, 1, 2, 0x2c, 0, 0, 0, 1, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Video mode panel information */
+/*---------------------------------------------------------------------------*/
+static struct videopanel_info truly_rm69090_qvga_cmd_video_panel = {
+ 1, 0, 0, 0, 1, 1, 2, 0, 0x9
+};
+
+/*---------------------------------------------------------------------------*/
+/* Lane configuration */
+/*---------------------------------------------------------------------------*/
+static struct lane_configuration truly_rm69090_qvga_cmd_lane_config = {
+ 1, 0, 1, 0, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel timing */
+/*---------------------------------------------------------------------------*/
+static const uint32_t truly_rm69090_qvga_cmd_12nm_timings[] = {
+ 0x04, 0x04, 0x01, 0x08, 0x00, 0x03, 0x01, 0x0D
+};
+
+static struct panel_timing truly_rm69090_qvga_cmd_timing_info = {
+ 0, 4, 0x09, 0x2c
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel reset sequence */
+/*---------------------------------------------------------------------------*/
+static struct panel_reset_sequence truly_rm69090_qvga_cmd_reset_seq = {
+ {1, 0, 1, }, {1, 12, 12, }, 2
+};
+
+/*---------------------------------------------------------------------------*/
+/* Backlight setting */
+/*---------------------------------------------------------------------------*/
+static struct backlight truly_rm69090_qvga_cmd_backlight = {
+ 2, 1, 255, 100, 2, "BL_CTL_DCS"
+};
+
+#endif /*_PANEL_TRULY_RM69090_QVGA_CMD_H_*/
diff --git a/platform/msm_shared/ab_partition_parser.c b/platform/msm_shared/ab_partition_parser.c
index 7cee1a8..53a671c 100644
--- a/platform/msm_shared/ab_partition_parser.c
+++ b/platform/msm_shared/ab_partition_parser.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2019, 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 met:
@@ -236,7 +236,7 @@
/*
Function: Switch active partitions.
*/
-void partition_switch_slots(int old_slot, int new_slot)
+void partition_switch_slots(int old_slot, int new_slot, boolean reset_success_bit)
{
#ifdef AB_DEBUG
dprintf(INFO, "Switching slots %s to %s\n",
@@ -255,9 +255,15 @@
((PART_ATT_PRIORITY_VAL |
PART_ATT_ACTIVE_VAL |
PART_ATT_MAX_RETRY_COUNT_VAL));
+
partition_entries[new_slot_index].attribute_flag &=
- (~PART_ATT_SUCCESSFUL_VAL
- & ~PART_ATT_UNBOOTABLE_VAL);
+ (~PART_ATT_UNBOOTABLE_VAL);
+ if (reset_success_bit &&
+ (partition_entries[new_slot_index].attribute_flag &
+ PART_ATT_SUCCESSFUL_VAL)) {
+ partition_entries[new_slot_index].attribute_flag &=
+ (~PART_ATT_SUCCESSFUL_VAL);
+ }
if (!attributes_updated)
attributes_updated = true;
@@ -395,7 +401,7 @@
next_slot = next_active_bootable_slot(partition_entries);
if (next_slot != INVALID)
{
- partition_switch_slots(boot_slot, next_slot);
+ partition_switch_slots(boot_slot, next_slot, false);
reboot_device(0);
}
else
diff --git a/platform/msm_shared/avb/libavb/avb_ops.c b/platform/msm_shared/avb/libavb/avb_ops.c
index 8600eb3..11f428a 100644
--- a/platform/msm_shared/avb/libavb/avb_ops.c
+++ b/platform/msm_shared/avb/libavb/avb_ops.c
@@ -57,6 +57,7 @@
#include <err.h>
#include <ab_partition_parser.h>
#include <partition_parser.h>
+#define MAX_FOOTER_SIZE 4096
struct partition_entry *PtnEntries;
@@ -177,7 +178,7 @@
}
*OutNumRead = 0;
- if (!getimage(Buffer, OutNumRead, Partition)) {
+ if (NumBytes > MAX_FOOTER_SIZE && !getimage(Buffer, OutNumRead, Partition)) {
/* API returns previously loaded Images buffer address and size */
dprintf(SPEW, "DEBUG: %s already loaded \n", Partition);
return AVB_IO_RESULT_OK;
diff --git a/platform/msm_shared/avb/libavb/avb_slot_verify.c b/platform/msm_shared/avb/libavb/avb_slot_verify.c
index 5818fa1..f44a145 100644
--- a/platform/msm_shared/avb/libavb/avb_slot_verify.c
+++ b/platform/msm_shared/avb/libavb/avb_slot_verify.c
@@ -175,7 +175,8 @@
goto out;
}
- if (avb_strcmp((const char*)hash_desc.hash_algorithm, "sha256") == 0) {
+ if (avb_strncmp((const char*)hash_desc.hash_algorithm, "sha256",
+ avb_strlen ("sha256")) == 0) {
uint32_t complete_len = hash_desc.salt_len + hash_desc.image_size;
digest = avb_malloc(AVB_SHA256_DIGEST_SIZE);
if(digest == NULL || hash_desc.salt_len > SALT_BUFF_OFFSET )
@@ -189,7 +190,8 @@
hash_find(image_buf, complete_len, digest, CRYPTO_AUTH_ALG_SHA256);
image_buf = SUB_SALT_BUFF_OFFSET(image_buf) + hash_desc.salt_len;
digest_len = AVB_SHA256_DIGEST_SIZE;
- } else if (avb_strcmp((const char*)hash_desc.hash_algorithm, "sha512") == 0) {
+ } else if (avb_strncmp((const char*)hash_desc.hash_algorithm, "sha512",
+ avb_strlen ("sha512")) == 0) {
AvbSHA512Ctx sha512_ctx;
uint8_t *dig;
digest = avb_malloc(AVB_SHA512_DIGEST_SIZE);
@@ -294,7 +296,7 @@
avb_debugv(part_name, ": Loading entire partition.\n", NULL);
io_ret = ops->read_from_partition(
- ops, part_name, 0 /* offset */, image_size, &image_buf, &part_num_read);
+ ops, requested_partitions[n], 0 /* offset */, image_size, &image_buf, &part_num_read);
if (io_ret == AVB_IO_RESULT_ERROR_OOM) {
ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
goto out;
@@ -365,7 +367,7 @@
size_t num_descriptors;
size_t n;
bool is_main_vbmeta;
- bool is_vbmeta_partition;
+ bool look_for_vbmeta_footer;
AvbVBMetaData* vbmeta_image_data = NULL;
ret = AVB_SLOT_VERIFY_RESULT_OK;
@@ -377,7 +379,14 @@
* vbmeta struct.
*/
is_main_vbmeta = (rollback_index_location == 0);
- is_vbmeta_partition = (avb_strcmp(partition_name, "vbmeta") == 0);
+
+ /* Don't use footers for vbmeta partitions ('vbmeta' or
+ * 'vbmeta_<partition_name>').
+ */
+ look_for_vbmeta_footer = true;
+ if (avb_strncmp(partition_name, "vbmeta", avb_strlen("vbmeta")) == 0) {
+ look_for_vbmeta_footer = false;
+ }
if (!avb_validate_utf8((const uint8_t*)partition_name, partition_name_len)) {
avb_error("Partition name is not valid UTF-8.\n");
@@ -407,7 +416,7 @@
vbmeta_offset = 0;
vbmeta_size = VBMETA_MAX_SIZE;
- if (is_vbmeta_partition) {
+ if (is_main_vbmeta) {
io_ret = ops->read_from_partition(ops,
partition_name,
vbmeta_offset,
@@ -419,47 +428,47 @@
goto out;
}
} else {
- uint8_t footer_buf[AVB_FOOTER_SIZE];
- size_t footer_num_read;
- AvbFooter footer;
+ if (look_for_vbmeta_footer) {
+ uint8_t footer_buf[AVB_FOOTER_SIZE];
+ size_t footer_num_read;
+ AvbFooter footer;
+ io_ret = ops->read_from_partition(ops,
+ partition_name,
+ -AVB_FOOTER_SIZE,
+ AVB_FOOTER_SIZE,
+ footer_buf,
+ &footer_num_read);
+ if (io_ret == AVB_IO_RESULT_ERROR_OOM) {
+ ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
+ goto out;
+ } else if (io_ret != AVB_IO_RESULT_OK) {
+ avb_errorv(full_partition_name, ": Error loading footer.\n", NULL);
+ ret = AVB_SLOT_VERIFY_RESULT_ERROR_IO;
+ goto out;
+ }
+ avb_assert(footer_num_read == AVB_FOOTER_SIZE);
- io_ret = ops->read_from_partition(ops,
- full_partition_name,
- -AVB_FOOTER_SIZE,
- AVB_FOOTER_SIZE,
- footer_buf,
- &footer_num_read);
- if (io_ret == AVB_IO_RESULT_ERROR_OOM) {
- ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
- goto out;
- } else if (io_ret != AVB_IO_RESULT_OK) {
- avb_errorv(full_partition_name, ": Error loading footer.\n", NULL);
- ret = AVB_SLOT_VERIFY_RESULT_ERROR_IO;
- goto out;
- }
- avb_assert(footer_num_read == AVB_FOOTER_SIZE);
-
- if (!avb_footer_validate_and_byteswap((const AvbFooter*)footer_buf,
- &footer)) {
- avb_errorv(full_partition_name, ": No footer detected.\n", NULL);
- } else {
- /* Basic footer sanity check since the data is untrusted. */
- if (footer.vbmeta_size > VBMETA_MAX_SIZE) {
- avb_errorv(
- full_partition_name, ": Invalid vbmeta size in footer.\n", NULL);
+ if (!avb_footer_validate_and_byteswap((const AvbFooter*)footer_buf,
+ &footer)) {
+ avb_errorv(full_partition_name, ": No footer detected.\n", NULL);
} else {
- vbmeta_offset = footer.vbmeta_offset;
- vbmeta_size = footer.vbmeta_size;
+ /* Basic footer sanity check since the data is untrusted. */
+ if (footer.vbmeta_size > VBMETA_MAX_SIZE) {
+ avb_errorv(
+ full_partition_name, ": Invalid vbmeta size in footer.\n", NULL);
+ } else {
+ vbmeta_offset = footer.vbmeta_offset;
+ vbmeta_size = footer.vbmeta_size;
+ }
}
}
-
vbmeta_buf = avb_malloc(vbmeta_size); // for chain partitions
if (vbmeta_buf == NULL) {
ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
goto out;
}
io_ret = ops->read_from_partition(ops,
- full_partition_name,
+ partition_name,
vbmeta_offset,
vbmeta_size,
vbmeta_buf,
@@ -474,7 +483,7 @@
* go try to get it from the boot partition instead.
*/
if (is_main_vbmeta && io_ret == AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION &&
- is_vbmeta_partition) {
+ !look_for_vbmeta_footer) {
avb_debugv(full_partition_name,
": No such partition. Trying 'boot' instead.\n",
NULL);
diff --git a/platform/msm_shared/avb/libavb/avb_sysdeps.h b/platform/msm_shared/avb/libavb/avb_sysdeps.h
index 55e3e19..6ed7d4f 100644
--- a/platform/msm_shared/avb/libavb/avb_sysdeps.h
+++ b/platform/msm_shared/avb/libavb/avb_sysdeps.h
@@ -75,6 +75,14 @@
*/
int avb_strcmp(const char* s1, const char* s2);
+/* Compare |n| bytes in two strings.
+ *
+ * Return an integer less than, equal to, or greater than zero if the
+ * first |n| bytes of |s1| is found, respectively, to be less than,
+ * to match, or be greater than the first |n| bytes of |s2|.
+ */
+int avb_strncmp(const char* s1, const char* s2, size_t n);
+
/* Copy |n| bytes from |src| to |dest|. */
void* avb_memcpy(void* dest, const void* src, size_t n);
diff --git a/platform/msm_shared/avb/libavb/avb_sysdeps_posix.c b/platform/msm_shared/avb/libavb/avb_sysdeps_posix.c
index dfbfc39..a155ac6 100644
--- a/platform/msm_shared/avb/libavb/avb_sysdeps_posix.c
+++ b/platform/msm_shared/avb/libavb/avb_sysdeps_posix.c
@@ -46,6 +46,10 @@
return strcmp(s1, s2);
}
+int avb_strncmp(const char* s1, const char* s2, size_t n) {
+ return strncmp(s1, s2, n);
+}
+
size_t avb_strlen(const char* str) {
return strlen(str);
}
diff --git a/platform/msm_shared/dev_tree.c b/platform/msm_shared/dev_tree.c
old mode 100644
new mode 100755
index fa7b28a..024b5c3
--- a/platform/msm_shared/dev_tree.c
+++ b/platform/msm_shared/dev_tree.c
@@ -113,6 +113,12 @@
return dtbo_idx;
}
+static int dtb_idx = INVALID_PTN;
+int get_dtb_idx (void)
+{
+ return dtb_idx;
+}
+
int fdt_check_header_ext(const void *fdt)
{
uintptr_t fdt_start, fdt_end;
@@ -621,6 +627,8 @@
uint32_t dtb_size = 0;
dt_info cur_dtb_info = {0};
dt_info best_dtb_info = {0};
+ uint32_t dtb_cnt = 0;
+ boolean find_best_dtb = false;
if (!dtb_offset){
dprintf(CRITICAL, "DTB offset is NULL\n");
@@ -642,7 +650,7 @@
break;
cur_dtb_info.dtb = dtb;
- dtb_read_find_match(&cur_dtb_info, &best_dtb_info, SOC_MATCH);
+ find_best_dtb = dtb_read_find_match(&cur_dtb_info, &best_dtb_info, SOC_MATCH);
if (cur_dtb_info.dt_match_val) {
if (cur_dtb_info.dt_match_val & BIT(SOC_MATCH)) {
if (check_all_bits_set(cur_dtb_info.dt_match_val)) {
@@ -651,8 +659,15 @@
}
}
}
- dprintf(SPEW, "Best Match DTB VAL = %x\n", best_dtb_info.dt_match_val);
+
+ dprintf(SPEW, "dtb count = %u local_soc_dt_match val = %x\n", dtb_cnt, best_dtb_info.dt_match_val);
dtb += dtb_size;
+
+ if (find_best_dtb) {
+ dtb_idx = dtb_cnt;
+ }
+ dtb_cnt++;
+
}
if (!best_dtb_info.dtb) {
dprintf(CRITICAL, "No match found for soc dtb type\n");
@@ -755,6 +770,7 @@
uint32_t msm_data_count;
uint32_t board_data_count;
uint32_t pmic_data_count;
+ uint32_t dtb_count = 0;;
root_offset = fdt_path_offset(dtb, "/");
if (root_offset < 0)
@@ -962,9 +978,11 @@
i = 0;
k = 0;
n = 0;
+ dtb_count++;
for (i = 0; i < msm_data_count; i++) {
for (j = 0; j < board_data_count; j++) {
- if (dtb_ver == DEV_TREE_VERSION_V3 && pmic_prop) {
+ dt_entry_array[k].idx = dtb_count;
+ if (dtb_ver == DEV_TREE_VERSION_V3 && pmic_prop){
for (n = 0; n < pmic_data_count; n++) {
dt_entry_array[k].platform_id = platform_data[i].platform_id;
dt_entry_array[k].soc_rev = platform_data[i].soc_rev;
@@ -1145,9 +1163,9 @@
* Will relocate the DTB to the tags addr if the device tree is found and return
* its address
*
- * Arguments: kernel - Start address of the kernel loaded in RAM
+ * Arguments: kernel - Start address of the kernel/bootimage loaded in RAM
* tags - Start address of the tags loaded in RAM
- * kernel_size - Size of the kernel in bytes
+ * kernel_size - Size of the kernel/bootimage size in bytes
*
* Return Value: DTB address : If appended device tree is found
* 'NULL' : Otherwise
@@ -1216,12 +1234,14 @@
if (best_match_dt_entry){
bestmatch_tag = (void *)best_match_dt_entry->offset;
bestmatch_tag_size = best_match_dt_entry->size;
- dprintf(INFO, "Best match DTB tags %u/%08x/0x%08x/%x/%x/%x/%x/%x/%x/%x\n",
- best_match_dt_entry->platform_id, best_match_dt_entry->variant_id,
- best_match_dt_entry->board_hw_subtype, best_match_dt_entry->soc_rev,
- best_match_dt_entry->pmic_rev[0], best_match_dt_entry->pmic_rev[1],
- best_match_dt_entry->pmic_rev[2], best_match_dt_entry->pmic_rev[3],
- best_match_dt_entry->offset, best_match_dt_entry->size);
+ dtb_idx = best_match_dt_entry->idx;
+ dprintf(INFO, "Best match DTB tags %u/%u/%08x/0x%08x/%x/%x/%x/%x/%x/%x/%x\n",
+ best_match_dt_entry->idx, best_match_dt_entry->platform_id,
+ best_match_dt_entry->variant_id, best_match_dt_entry->board_hw_subtype,
+ best_match_dt_entry->soc_rev, best_match_dt_entry->pmic_rev[0],
+ best_match_dt_entry->pmic_rev[1], best_match_dt_entry->pmic_rev[2],
+ best_match_dt_entry->pmic_rev[3], best_match_dt_entry->offset,
+ best_match_dt_entry->size);
dprintf(INFO, "Using pmic info 0x%0x/0x%x/0x%x/0x%0x for device 0x%0x/0x%x/0x%x/0x%0x\n",
best_match_dt_entry->pmic_rev[0], best_match_dt_entry->pmic_rev[1],
best_match_dt_entry->pmic_rev[2], best_match_dt_entry->pmic_rev[3],
diff --git a/platform/msm_shared/include/ab_partition_parser.h b/platform/msm_shared/include/ab_partition_parser.h
index 607a412..2001b7f 100644
--- a/platform/msm_shared/include/ab_partition_parser.h
+++ b/platform/msm_shared/include/ab_partition_parser.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017, 2019, 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 met:
@@ -69,7 +69,7 @@
void partition_mark_active_slot(); /* Marking slot active */
void partition_reset_attributes(); /* Resetting slot attr. */
void partition_fill_slot_meta(); /* Fill slot meta infomation */
-void partition_switch_slots(); /* Switching slots */
+void partition_switch_slots(int old_slot, int new_slot, boolean reset_success_bit); /* Switching slots */
void partition_deactivate_slot(int slot); /* Mark slot unbootable and reset other attributes*/
void partition_activate_slot(int slot); /* Mark slot bootable and set other attributes*/
int partition_find_boot_slot(); /* Find bootable partition */
diff --git a/platform/msm_shared/include/dev_tree.h b/platform/msm_shared/include/dev_tree.h
index 1d8dd07..4449286 100644
--- a/platform/msm_shared/include/dev_tree.h
+++ b/platform/msm_shared/include/dev_tree.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014,2017-2018 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2014,2017-2019 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
@@ -163,6 +163,7 @@
uint32_t pmic_rev[4];
uint32_t offset;
uint32_t size;
+ uint32_t idx;
};
struct dt_table
@@ -256,4 +257,5 @@
int dev_tree_add_mem_info(void *fdt, uint32_t offset, uint64_t size, uint64_t addr);
void *dev_tree_appended(void *kernel, uint32_t kernel_size, uint32_t dtb_offset, void *tags);
int get_dtbo_idx (void);
+int get_dtb_idx (void);
#endif
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
old mode 100644
new mode 100755
index 1e63629..9b19fd3
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -518,6 +518,7 @@
HW_PLATFORM_SUBTYPE_MTP_WEAR = 5,
HW_PLATFORM_SUBTYPE_SGLTE = 6,
HW_PLATFORM_SUBTYPE_429W_PM660 = 6,
+ HW_PLATFORM_SUBTYPE_429W_PM660_WDP = 7,
HW_PLATFORM_SUBTYPE_DSDA = 7,
HW_PLATFORM_SUBTYPE_DSDA2 = 8,
HW_PLATFORM_SUBTYPE_SGLTE2 = 9,
diff --git a/target/msm8952/init.c b/target/msm8952/init.c
old mode 100644
new mode 100755
index 136ab70..c7f2da3
--- a/target/msm8952/init.c
+++ b/target/msm8952/init.c
@@ -112,8 +112,7 @@
static int sdm429_pm660_target()
{
- if ((platform_is_sdm429() || platform_is_sdm429w()) && (board_hardware_subtype()
- == HW_PLATFORM_SUBTYPE_429W_PM660))
+ if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w())
return 1;
else
return 0;
diff --git a/target/msm8952/oem_panel.c b/target/msm8952/oem_panel.c
old mode 100644
new mode 100755
index e49252c..07eee04
--- a/target/msm8952/oem_panel.c
+++ b/target/msm8952/oem_panel.c
@@ -66,6 +66,7 @@
#include "include/panel_hx8399c_fhd_pluse_video.h"
#include "include/panel_hx8399c_hd_plus_video.h"
#include "include/panel_edo_rm67162_qvga_cmd.h"
+#include "include/panel_truly_rm69090_qvga_cmd.h"
#include "include/panel_nt35695b_truly_fhd_video.h"
#include "include/panel_nt35695b_truly_fhd_cmd.h"
@@ -96,6 +97,7 @@
NT35695B_TRULY_FHD_VIDEO_PANEL,
NT35695B_TRULY_FHD_CMD_PANEL,
RM67162_QVGA_CMD_PANEL,
+ RM69090_QVGA_CMD_PANEL,
UNKNOWN_PANEL
};
@@ -131,6 +133,7 @@
{"nt35695b_truly_fhd_video", NT35695B_TRULY_FHD_VIDEO_PANEL},
{"nt35695b_truly_fhd_cmd", NT35695B_TRULY_FHD_CMD_PANEL},
{"rm67162_qvga_cmd", RM67162_QVGA_CMD_PANEL},
+ {"rm69090_qvga_cmd", RM69090_QVGA_CMD_PANEL},
};
static uint32_t panel_id;
@@ -849,6 +852,37 @@
TIMING_SIZE_12NM);
pinfo->mipi.tx_eot_append = true;
break;
+ case RM69090_QVGA_CMD_PANEL:
+ panelstruct->paneldata = &truly_rm69090_qvga_cmd_panel_data;
+ panelstruct->panelres = &truly_rm69090_qvga_cmd_panel_res;
+ panelstruct->color = &truly_rm69090_qvga_cmd_color;
+ panelstruct->videopanel =
+ &truly_rm69090_qvga_cmd_video_panel;
+ panelstruct->commandpanel =
+ &truly_rm69090_qvga_cmd_command_panel;
+ panelstruct->state = &truly_rm69090_qvga_cmd_state;
+ panelstruct->laneconfig =
+ &truly_rm69090_qvga_cmd_lane_config;
+ panelstruct->paneltiminginfo
+ = &truly_rm69090_qvga_cmd_timing_info;
+ panelstruct->panelresetseq
+ = &truly_rm69090_qvga_cmd_reset_seq;
+ panelstruct->backlightinfo = &truly_rm69090_qvga_cmd_backlight;
+ pinfo->labibb = NULL;
+ pinfo->mipi.panel_on_cmds
+ = truly_rm69090_qvga_cmd_on_command;
+ pinfo->mipi.num_of_panel_on_cmds
+ = TRULY_RM69090_QVGA_CMD_ON_COMMAND;
+ pinfo->mipi.panel_off_cmds
+ = truly_rm69090_qvga_cmd_off_command;
+ pinfo->mipi.num_of_panel_off_cmds
+ = TRULY_RM69090_QVGA_CMD_OFF_COMMAND;
+ if (phy_db->pll_type == DSI_PLL_TYPE_12NM)
+ memcpy(phy_db->timing,
+ truly_rm69090_qvga_cmd_12nm_timings,
+ TIMING_SIZE_12NM);
+ pinfo->mipi.tx_eot_append = true;
+ break;
case NT35695B_TRULY_FHD_VIDEO_PANEL:
panelstruct->paneldata = &nt35695b_truly_fhd_video_panel_data;
panelstruct->panelres = &nt35695b_truly_fhd_video_panel_res;
@@ -1042,9 +1076,11 @@
}
if (platform_is_sdm429() || platform_is_sdm429w()) {
- if (hw_subtype == HW_PLATFORM_SUBTYPE_429W_PM660) /* Spyro target */
- panel_id = RM67162_QVGA_CMD_PANEL;
- else
+ if (hw_subtype == HW_PLATFORM_SUBTYPE_429W_PM660) /* WTP 2700 DVT */
+ panel_id = RM67162_QVGA_CMD_PANEL;
+ else if (hw_subtype == HW_PLATFORM_SUBTYPE_429W_PM660_WDP) /* WDP 2700 */
+ panel_id = RM69090_QVGA_CMD_PANEL;
+ else
panel_id = HX8399C_HD_PLUS_VIDEO_PANEL;
}
diff --git a/target/msm8952/regulator.c b/target/msm8952/regulator.c
old mode 100644
new mode 100755
index 143d9c0..873077f
--- a/target/msm8952/regulator.c
+++ b/target/msm8952/regulator.c
@@ -187,8 +187,7 @@
rpm_send_data(&ldo2[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
}
- if ((platform_is_sdm429() || platform_is_sdm429w()) && hw_subtype
- == HW_PLATFORM_SUBTYPE_429W_PM660) {
+ if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w()) {
if (enable & REG_LDO13)
rpm_send_data(&ldo13_pm660[GENERIC_ENABLE][0],
36, RPM_REQUEST_TYPE);
diff --git a/target/msm8952/target_display.c b/target/msm8952/target_display.c
old mode 100644
new mode 100755
index 43a3382..0dc6834
--- a/target/msm8952/target_display.c
+++ b/target/msm8952/target_display.c
@@ -63,6 +63,8 @@
#define TRULY_VID_PANEL_STRING "1:dsi:0:qcom,mdss_dsi_truly_720p_video:1:none:cfg:single_dsi"
#define TRULY_CMD_PANEL_STRING "1:dsi:0:qcom,mdss_dsi_truly_720p_cmd:1:none:cfg:single_dsi"
+#define VARIANT_MAJOR_MASK (0x00ff0000)
+
/*---------------------------------------------------------------------------*/
/* GPIO configuration */
/*---------------------------------------------------------------------------*/
@@ -452,11 +454,16 @@
pinfo->mipi.use_enable_gpio = 1;
} else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w()) {
reset_gpio.pin_id = 60;
- if ((platform_is_sdm429() || platform_is_sdm429w()) && hw_subtype
- == HW_PLATFORM_SUBTYPE_429W_PM660) {
- reset_gpio.pin_id = 60;
- pinfo->mipi.use_enable_gpio = 1;
- enable_gpio.pin_id = 69;
+ if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w()) {
+ if (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660_WDP) {
+ reset_gpio.pin_id = 60;
+ pinfo->mipi.use_enable_gpio = 0;
+ }
+ else {
+ reset_gpio.pin_id = 60;
+ pinfo->mipi.use_enable_gpio = 1;
+ enable_gpio.pin_id = 69;
+ }
}
} else if ((hw_id == HW_PLATFORM_QRD) &&
(hw_subtype == HW_PLATFORM_SUBTYPE_POLARIS)) {
@@ -484,6 +491,13 @@
.out_strength = PM_GPIO_OUT_DRIVE_HIGH,
};
+ if (((board_target_id() & VARIANT_MAJOR_MASK)) &&
+ platform_is_sdm429w()) {
+ /* enable PM660 GPIO-12 for backlight enable */
+ bkl_en_gpio.pin_id = 12;
+ gpio_param.inv_int_pol = PM_GPIO_INVERT;
+ }
+
dprintf(SPEW, "%s: gpio=%d enable=%d\n", __func__,
bkl_en_gpio.pin_id, enable);
@@ -665,9 +679,10 @@
else
ldo_num |= REG_LDO2;
- if ((platform_is_sdm429() || platform_is_sdm429w()) && hw_subtype
- == HW_PLATFORM_SUBTYPE_429W_PM660)
- ldo_num |= REG_LDO13 | REG_LDO15;
+ if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w()) {
+ ldo_num &= ~(REG_LDO17 | REG_LDO5);
+ ldo_num |= REG_LDO13 | REG_LDO15;
+ }
if (enable) {
regulator_enable(ldo_num);