Merge e19e0aa3f9688f52039a69557198508f89efb4d1 on remote branch
Change-Id: I6e7ed690e7fa9a386c4a25845edb4b2cab5fbf4c
diff --git a/AndroidBoot.mk b/AndroidBoot.mk
index 8697f7d..6c67721 100644
--- a/AndroidBoot.mk
+++ b/AndroidBoot.mk
@@ -51,6 +51,12 @@
VERIFIED_BOOT_2 := VERIFIED_BOOT_2=0
endif
+ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
+ DYNAMIC_PARTITION_SUPPORT := DYNAMIC_PARTITION_SUPPORT=1
+else
+ DYNAMIC_PARTITION_SUPPORT := DYNAMIC_PARTITION_SUPPORT=0
+endif
+
ifeq ($(BOARD_DTBO_NOT_SUPPORTED),true)
TARGET_DTBO_NOT_SUPPORTED := TARGET_DTBO_NOT_SUPPORTED=1
else
@@ -125,7 +131,7 @@
# ELF binary for ABOOT
TARGET_ABOOT_ELF := $(PRODUCT_OUT)/aboot.elf
$(TARGET_ABOOT_ELF): ABOOT_CLEAN | $(ABOOT_OUT)
- $(MAKE) -C $(LK_PATH) TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=$(CROOT_DIR)/$(ABOOT_OUT) $(BOOTLOADER_PLATFORM) $(EMMC_BOOT) $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(VERIFIED_BOOT_2) $(TARGET_DTBO_NOT_SUPPORTED) $(ENABLE_DISPLAY) $(ENABLE_KASLRSEED) $(ENABLE_BOOTDEVICE_MOUNT) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME) $(ENABLE_VB_ATTEST) $(OSVERSION_IN_BOOTIMAGE) $(QSEECOM_SECAPP_REGION_2MB) $(TARGET_USE_SYSTEM_AS_ROOT_IMAGE)
+ $(MAKE) -C $(LK_PATH) TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=$(CROOT_DIR)/$(ABOOT_OUT) $(BOOTLOADER_PLATFORM) $(EMMC_BOOT) $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(VERIFIED_BOOT_2) $(TARGET_DTBO_NOT_SUPPORTED) $(ENABLE_DISPLAY) $(ENABLE_KASLRSEED) $(ENABLE_BOOTDEVICE_MOUNT) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME) $(ENABLE_VB_ATTEST) $(OSVERSION_IN_BOOTIMAGE) $(QSEECOM_SECAPP_REGION_2MB) $(TARGET_USE_SYSTEM_AS_ROOT_IMAGE) $(DYNAMIC_PARTITION_SUPPORT)
# NAND variant output
TARGET_NAND_BOOTLOADER := $(PRODUCT_OUT)/appsboot.mbn
@@ -154,7 +160,7 @@
# Top level for eMMC variant targets
$(TARGET_EMMC_BOOTLOADER): emmc_appsbootldr_clean | $(EMMC_BOOTLOADER_OUT) $(INSTALLED_KEYSTOREIMAGE_TARGET)
- $(MAKE) -C $(LK_PATH) TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=$(CROOT_DIR)/$(EMMC_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) EMMC_BOOT=1 $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(VERIFIED_BOOT_2) $(TARGET_DTBO_NOT_SUPPORTED) $(ENABLE_DISPLAY) $(ENABLE_KASLRSEED) $(ENABLE_BOOTDEVICE_MOUNT) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME) $(ENABLE_VB_ATTEST) $(OSVERSION_IN_BOOTIMAGE) $(ENABLE_BG_SUPPORT) $(QSEECOM_SECAPP_REGION_2MB) $(TARGET_USE_SYSTEM_AS_ROOT_IMAGE)
+ $(MAKE) -C $(LK_PATH) TOOLCHAIN_PREFIX=$(CROSS_COMPILE) BOOTLOADER_OUT=$(CROOT_DIR)/$(EMMC_BOOTLOADER_OUT) $(BOOTLOADER_PLATFORM) EMMC_BOOT=1 $(SIGNED_KERNEL) $(VERIFIED_BOOT) $(VERIFIED_BOOT_2) $(TARGET_DTBO_NOT_SUPPORTED) $(ENABLE_DISPLAY) $(ENABLE_KASLRSEED) $(ENABLE_BOOTDEVICE_MOUNT) $(DEVICE_STATUS) $(BUILD_VARIANT) $(BOARD_NAME) $(ENABLE_VB_ATTEST) $(OSVERSION_IN_BOOTIMAGE) $(ENABLE_BG_SUPPORT) $(QSEECOM_SECAPP_REGION_2MB) $(TARGET_USE_SYSTEM_AS_ROOT_IMAGE) $(DYNAMIC_PARTITION_SUPPORT)
# Keep build NAND & eMMC as default for targets still using TARGET_BOOTLOADER
TARGET_BOOTLOADER := $(PRODUCT_OUT)/EMMCBOOT.MBN
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 534db14..584ba35 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -2,7 +2,7 @@
* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
- * Copyright (c) 2009-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-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:
@@ -162,6 +162,8 @@
#else
static const char *emmc_cmdline = " androidboot.emmc=true";
#endif
+static const char *dynamic_bootdev_cmdline =
+ " androidboot.boot_devices=soc/";
static const char *usb_sn_cmdline = " androidboot.serialno=";
static const char *androidboot_mode = " androidboot.mode=";
@@ -484,12 +486,19 @@
}
if (target_is_emmc_boot()) {
cmdline_len += strlen(emmc_cmdline);
-#if USE_BOOTDEV_CMDLINE
boot_dev_buf = (char *) malloc(sizeof(char) * BOOT_DEV_MAX_LEN);
- ASSERT(boot_dev_buf);
- platform_boot_dev_cmdline(boot_dev_buf);
- cmdline_len += strlen(boot_dev_buf);
+ if (!boot_dev_buf) {
+ dprintf(CRITICAL, "ERROR: Failed to allocate boot_dev_buf\n");
+ } else {
+ platform_boot_dev_cmdline(boot_dev_buf);
+#if USE_BOOTDEV_CMDLINE
+ cmdline_len += strlen(boot_dev_buf);
#endif
+ if (target_dynamic_partition_supported()) {
+ cmdline_len += strlen(dynamic_bootdev_cmdline);
+ cmdline_len += strlen(boot_dev_buf);
+ }
+ }
}
cmdline_len += strlen(usb_sn_cmdline);
@@ -663,7 +672,10 @@
partition_multislot_is_supported())
{
cmdline_len += strlen(sys_path_cmdline);
- if (!boot_into_recovery)
+
+ /* For dynamic partition, support skip skip_initramfs */
+ if (!target_dynamic_partition_supported() &&
+ !boot_into_recovery)
cmdline_len += strlen(skip_ramfs);
}
@@ -723,9 +735,22 @@
while ((*dst++ = *src++));
#if USE_BOOTDEV_CMDLINE
src = boot_dev_buf;
- if (have_cmdline) --dst;
- while ((*dst++ = *src++));
+ if (have_cmdline &&
+ boot_dev_buf) {
+ --dst;
+ while ((*dst++ = *src++));
+ }
#endif
+ /* Dynamic partition append boot_devices */
+ if (target_dynamic_partition_supported() &&
+ boot_dev_buf) {
+ src = dynamic_bootdev_cmdline;
+ if (have_cmdline) --dst;
+ while ((*dst++ = *src++));
+ src = boot_dev_buf;
+ if (have_cmdline) --dst;
+ while ((*dst++ = *src++));
+ }
}
#if VERIFIED_BOOT
@@ -923,7 +948,8 @@
partition_multislot_is_supported()) &&
have_cmdline)
{
- if (!boot_into_recovery)
+ if (!target_dynamic_partition_supported() &&
+ !boot_into_recovery)
{
src = skip_ramfs;
--dst;
@@ -1504,7 +1530,8 @@
/* For a/b recovery image code is on boot partition.
If we support multislot, always use boot partition. */
if (boot_into_recovery &&
- (!partition_multislot_is_supported()))
+ ((!partition_multislot_is_supported()) ||
+ (target_dynamic_partition_supported())))
ptn_name = "recovery";
else
ptn_name = "boot";
@@ -4387,6 +4414,40 @@
return;
}
+#if DYNAMIC_PARTITION_SUPPORT
+void cmd_reboot_fastboot(const char *arg, void *data, unsigned sz)
+{
+ dprintf(INFO, "rebooting the device - userspace fastboot\n");
+ if (send_recovery_cmd(RECOVERY_BOOT_FASTBOOT_CMD)) {
+ dprintf(CRITICAL, "ERROR: Failed to update recovery commands\n");
+ fastboot_fail("Failed to update recovery command");
+ return;
+ }
+ fastboot_okay("");
+ reboot_device(REBOOT_MODE_UNKNOWN);
+
+ //shouldn't come here.
+ dprintf(CRITICAL, "ERROR: Failed to reboot device\n");
+ return;
+}
+
+void cmd_reboot_recovery(const char *arg, void *data, unsigned sz)
+{
+ dprintf(INFO, "rebooting the device - recovery\n");
+ if (send_recovery_cmd(RECOVERY_BOOT_RECOVERY_CMD)) {
+ dprintf(CRITICAL, "ERROR: Failed to update recovery commands\n");
+ fastboot_fail("Failed to update recovery command");
+ return;
+ }
+ fastboot_okay("");
+ reboot_device(REBOOT_MODE_UNKNOWN);
+
+ //shouldn't come here.
+ dprintf(CRITICAL, "ERROR: Failed to reboot device\n");
+ return;
+}
+#endif
+
void cmd_reboot_bootloader(const char *arg, void *data, unsigned sz)
{
dprintf(INFO, "rebooting the device\n");
@@ -4910,6 +4971,10 @@
{"oem off-mode-charge", cmd_oem_off_mode_charger},
{"oem select-display-panel", cmd_oem_select_display_panel},
{"set_active",cmd_set_active},
+#if DYNAMIC_PARTITION_SUPPORT
+ {"reboot-fastboot",cmd_reboot_fastboot},
+ {"reboot-recovery",cmd_reboot_recovery},
+#endif
#if UNITTEST_FW_SUPPORT
{"oem run-tests", cmd_oem_runtests},
#endif
@@ -4988,6 +5053,8 @@
fastboot_publish("battery-voltage", (const char *) battery_voltage);
fastboot_publish("battery-soc-ok", (const char *) battery_soc_ok);
#endif
+ if (target_dynamic_partition_supported())
+ fastboot_publish("is-userspace", "no");
}
void aboot_init(const struct app_descriptor *app)
diff --git a/app/aboot/recovery.c b/app/aboot/recovery.c
index 0cc2ceb..389b91d 100644
--- a/app/aboot/recovery.c
+++ b/app/aboot/recovery.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-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
@@ -241,7 +241,7 @@
sizeof(msg.command), msg.command);
}
- if (!strcmp("boot-recovery",msg.command))
+ if (!strcmp(RECOVERY_BOOT_RECOVERY_CMD, msg.command))
{
if(!strcmp("RADIO",msg.status))
{
@@ -267,6 +267,12 @@
return 0;
}
+ if (target_dynamic_partition_supported() &&
+ !strcmp(RECOVERY_BOOT_FASTBOOT_CMD, msg.command)) {
+ boot_into_recovery = 1; // Boot in userspace fastboot mode
+ return 0;
+ }
+
if (!strcmp("update-radio",msg.command)) {
dprintf(INFO,"start radio update\n");
valid_command = 1;
@@ -369,6 +375,28 @@
return 0;
}
+/* Generic funcition to write misc commands. */
+int send_recovery_cmd(const char *command)
+{
+ struct recovery_message msg;
+ int status = 0;
+ memset(&msg, 0, sizeof(msg));
+
+ /* Populate command to msg */
+ snprintf(msg.command,
+ sizeof(msg.command),
+ command);
+
+ dprintf(INFO,"Recovery command: %s\n", msg.command);
+ if (target_is_emmc_boot())
+ /* Update emmc partition */
+ status = emmc_set_recovery_msg(&msg);
+ else
+ status = set_recovery_message(&msg);
+
+ return status;
+}
+
int _emmc_recovery_init(void)
{
int update_status = 0;
@@ -394,7 +422,12 @@
sizeof(msg->command), msg->command);
}
- if (!strcmp(msg->command, "boot-recovery")) {
+ if (!strcmp(msg->command, RECOVERY_BOOT_RECOVERY_CMD)) {
+ boot_into_recovery = 1;
+ }
+
+ if (target_dynamic_partition_supported() &&
+ !strcmp(msg->command, RECOVERY_BOOT_FASTBOOT_CMD)) {
boot_into_recovery = 1;
}
diff --git a/app/aboot/recovery.h b/app/aboot/recovery.h
index 177148a..da7d400 100644
--- a/app/aboot/recovery.h
+++ b/app/aboot/recovery.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-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
@@ -38,6 +38,9 @@
#define BOOTSELECT_FORMAT (1 << 31)
#define BOOTSELECT_FACTORY (1 << 30)
+#define RECOVERY_BOOT_RECOVERY_CMD "boot-recovery"
+#define RECOVERY_BOOT_FASTBOOT_CMD "boot-fastboot"
+
/* bootselect partition format structure */
struct boot_selection_info {
uint32_t signature; // Contains value BOOTSELECT_SIGNATURE defined above
@@ -78,7 +81,7 @@
int get_recovery_message(struct recovery_message *out);
int set_recovery_message(const struct recovery_message *in);
-
+int send_recovery_cmd(const char *command);
int recovery_init (void);
/* This function will look for the ffbm cookie in the misc partition.
* Upon finding a valid cookie it will return 1 and place the cookie
diff --git a/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h b/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h
new file mode 100644
index 0000000..d91a1b7
--- /dev/null
+++ b/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h
@@ -0,0 +1,203 @@
+/* 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_EDO_RM67162_QVGA_CMD_H_
+#define _PANEL_EDO_RM67162_QVGA_CMD_H_
+/*---------------------------------------------------------------------------*/
+/* HEADER files */
+/*---------------------------------------------------------------------------*/
+#include "panel.h"
+
+/*---------------------------------------------------------------------------*/
+/* Panel configuration */
+/*---------------------------------------------------------------------------*/
+static struct panel_config edo_rm67162_qvga_cmd_panel_data = {
+ "qcom,mdss_dsi_edo_rm67162_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
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel resolution */
+/*---------------------------------------------------------------------------*/
+static struct panel_resolution edo_rm67162_qvga_cmd_panel_res = {
+ 320, 360, 140, 164, 8, 0, 6, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel color information */
+/*---------------------------------------------------------------------------*/
+static struct color_info edo_rm67162_qvga_cmd_color = {
+ 24, 0, 0xff, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel on/off command information */
+/*---------------------------------------------------------------------------*/
+static char edo_rm67162_qvga_cmd_on_cmd0[] = {
+ 0x02, 0x00, 0x29, 0xC0,
+ 0xFE, 0x0A, 0xFF, 0xFF,
+};
+
+static char edo_rm67162_qvga_cmd_on_cmd1[] = {
+ 0x02, 0x00, 0x29, 0xC0,
+ 0x29, 0x90, 0xFF, 0xFF,
+};
+
+static char edo_rm67162_qvga_cmd_on_cmd2[] = {
+ 0x02, 0x00, 0x29, 0xC0,
+ 0xFE, 0x05, 0xFF, 0xFF,
+};
+
+static char edo_rm67162_qvga_cmd_on_cmd3[] = {
+ 0x02, 0x00, 0x29, 0xC0,
+ 0x05, 0x00, 0xFF, 0xFF,
+};
+
+static char edo_rm67162_qvga_cmd_on_cmd4[] = {
+ 0x02, 0x00, 0x29, 0xC0,
+ 0xFE, 0x00, 0xFF, 0xFF,
+};
+
+static char edo_rm67162_qvga_cmd_on_cmd5[] = {
+ 0x02, 0x00, 0x29, 0xC0,
+ 0x35, 0x00, 0xFF, 0xFF,
+};
+
+static char edo_rm67162_qvga_cmd_on_cmd6[] = {
+ 0x02, 0x00, 0x29, 0xC0,
+ 0x51, 0x00, 0xFF, 0xFF,
+};
+
+static char edo_rm67162_qvga_cmd_on_cmd7[] = {
+ 0x02, 0x00, 0x29, 0xC0,
+ 0x53, 0x20, 0xFF, 0xFF,
+};
+
+static char edo_rm67162_qvga_cmd_on_cmd8[] = {
+ 0x02, 0x00, 0x29, 0xC0,
+ 0x11, 0x00, 0xFF, 0xFF,
+};
+
+static char edo_rm67162_qvga_cmd_on_cmd9[] = {
+ 0x02, 0x00, 0x29, 0xC0,
+ 0x29, 0x00, 0xFF, 0xFF,
+};
+
+static struct mipi_dsi_cmd edo_rm67162_qvga_cmd_on_command[] = {
+ {0x8, edo_rm67162_qvga_cmd_on_cmd0, 0x00},
+ {0x8, edo_rm67162_qvga_cmd_on_cmd1, 0x00},
+ {0x8, edo_rm67162_qvga_cmd_on_cmd2, 0x00},
+ {0x8, edo_rm67162_qvga_cmd_on_cmd3, 0x00},
+ {0x8, edo_rm67162_qvga_cmd_on_cmd4, 0x00},
+ {0x8, edo_rm67162_qvga_cmd_on_cmd5, 0x00},
+ {0x8, edo_rm67162_qvga_cmd_on_cmd6, 0x00},
+ {0x8, edo_rm67162_qvga_cmd_on_cmd7, 0x00},
+ {0x8, edo_rm67162_qvga_cmd_on_cmd8, 0x78},
+ {0x8, edo_rm67162_qvga_cmd_on_cmd9, 0x05}
+};
+
+#define EDO_RM67162_QVGA_CMD_ON_COMMAND 10
+
+
+static char edo_rm67162_qvga_cmdoff_cmd0[] = {
+ 0x51, 0x00, 0x05, 0x80
+};
+
+static char edo_rm67162_qvga_cmdoff_cmd1[] = {
+ 0x28, 0x00, 0x05, 0x80
+};
+
+static char edo_rm67162_qvga_cmdoff_cmd2[] = {
+ 0x10, 0x00, 0x05, 0x80
+};
+
+static char edo_rm67162_qvga_cmdoff_cmd3[] = {
+ 0x4F, 0x01, 0x05, 0x80
+};
+
+static struct mipi_dsi_cmd edo_rm67162_qvga_cmd_off_command[] = {
+ {0x4, edo_rm67162_qvga_cmdoff_cmd0, 0x05},
+ {0x4, edo_rm67162_qvga_cmdoff_cmd1, 0x14},
+ {0x4, edo_rm67162_qvga_cmdoff_cmd2, 0x78},
+ {0x4, edo_rm67162_qvga_cmdoff_cmd3, 0x14}
+};
+
+#define EDO_RM67162_QVGA_CMD_OFF_COMMAND 4
+
+
+static struct command_state edo_rm67162_qvga_cmd_state = {
+ 0, 1
+};
+
+/*---------------------------------------------------------------------------*/
+/* 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
+};
+
+/*---------------------------------------------------------------------------*/
+/* Video mode panel information */
+/*---------------------------------------------------------------------------*/
+static struct videopanel_info edo_rm67162_qvga_cmd_video_panel = {
+ 1, 0, 0, 0, 1, 1, 2, 0, 0x9
+};
+
+/*---------------------------------------------------------------------------*/
+/* Lane configuration */
+/*---------------------------------------------------------------------------*/
+static struct lane_configuration edo_rm67162_qvga_cmd_lane_config = {
+ 1, 0, 1, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel timing */
+/*---------------------------------------------------------------------------*/
+static const uint32_t edo_rm67162_qvga_cmd_12nm_timings[] = {
+ 0x06, 0x05, 0x01, 0x01, 0x00, 0x03, 0x01, 0x03
+};
+
+static struct panel_timing edo_rm67162_qvga_cmd_timing_info = {
+ 0, 4, 0x20, 0x2c
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel reset sequence */
+/*---------------------------------------------------------------------------*/
+static struct panel_reset_sequence edo_rm67162_qvga_cmd_reset_seq = {
+ {1, 0, 1, }, {1, 12, 12, }, 2
+};
+
+/*---------------------------------------------------------------------------*/
+/* Backlight setting */
+/*---------------------------------------------------------------------------*/
+static struct backlight edo_rm67162_qvga_cmd_backlight = {
+ 1, 1, 4095, 100, 1, "PMIC_8941"
+};
+
+#endif /*_PANEL_EDO_RM67162_QVGA_CMD_H_*/
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index 3f0a83d..b908b14 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -85,6 +85,7 @@
/*Target power off reasons*/
#define KPDPWR_AND_RESIN 32
#define STAGE3 128
+#define PM660_STAGE3 32
struct pm8x41_gpio {
int direction;
@@ -234,6 +235,8 @@
uint8_t pm660_get_pon_reason();
uint8_t pm8950_get_pon_reason();
uint8_t pmi632_get_pon_reason();
+uint8_t pm660_get_pon_poff_reason1();
+uint8_t pm660_get_pon_poff_reason2();
uint8_t pm8x41_get_pon_poff_reason1();
uint8_t pm8x41_get_pon_poff_reason2();
uint32_t pm8x41_get_pwrkey_is_pressed();
diff --git a/dev/pmic/pm8x41/include/pm8x41_hw.h b/dev/pmic/pm8x41/include/pm8x41_hw.h
index d719243..14f693b 100644
--- a/dev/pmic/pm8x41/include/pm8x41_hw.h
+++ b/dev/pmic/pm8x41/include/pm8x41_hw.h
@@ -71,6 +71,8 @@
#define PON_PON_REASON1 0x808
#define PM660_PON_REASON1 0x8C0
#define PM660_PON_WARMBOOT_STATUS1 0x8C2
+#define PM660_PON_POFF_REASON1 0x8C5
+#define PM660_PON_POFF_REASON2 0x8C7
#define PON_WARMBOOT_STATUS1 0x80A
#define PON_WARMBOOT_STATUS2 0x80B
#define PON_POFF_REASON1 0x80C
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index 6575f95..fb6e180 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -671,6 +671,16 @@
return pon_reason;
}
+uint8_t pm660_get_pon_poff_reason1()
+{
+ return REG_READ(PM660_PON_POFF_REASON1);
+}
+
+uint8_t pm660_get_pon_poff_reason2()
+{
+ return REG_READ(PM660_PON_POFF_REASON2);
+}
+
uint8_t pm8x41_get_pon_poff_reason1()
{
return REG_READ(PON_POFF_REASON1);
diff --git a/dev/qpnp_haptic/qpnp_haptic.c b/dev/qpnp_haptic/qpnp_haptic.c
index ec91d2a..d360580 100644
--- a/dev/qpnp_haptic/qpnp_haptic.c
+++ b/dev/qpnp_haptic/qpnp_haptic.c
@@ -31,23 +31,24 @@
#include <pm_vib.h>
#include <target.h>
#include <vibrator.h>
+#include <smem.h>
-#define HAPTIC_BASE (PMI_SECOND_SLAVE_ADDR_BASE+ 0xC000)
-#define QPNP_HAP_EN_CTL_REG (HAPTIC_BASE + 0x46)
-#define QPNP_HAP_EN_CTL2_REG (HAPTIC_BASE + 0x48)
-#define QPNP_HAP_ACT_TYPE_REG (HAPTIC_BASE + 0x4C)
-#define QPNP_HAP_WAV_SHAPE_REG (HAPTIC_BASE + 0x4D)
-#define QPNP_HAP_PLAY_MODE_REG (HAPTIC_BASE + 0x4E)
-#define QPNP_HAP_LRA_AUTO_RES_REG (HAPTIC_BASE + 0x4F)
-#define QPNP_HAP_VMAX_REG (HAPTIC_BASE + 0x51)
-#define QPNP_HAP_ILIM_REG (HAPTIC_BASE + 0x52)
-#define QPNP_HAP_SC_DEB_REG (HAPTIC_BASE + 0x53)
-#define QPNP_HAP_RATE_CFG1_REG (HAPTIC_BASE + 0x54)
-#define QPNP_HAP_RATE_CFG2_REG (HAPTIC_BASE + 0x55)
-#define QPNP_HAP_INT_PWM_REG (HAPTIC_BASE + 0x56)
-#define QPNP_HAP_PWM_CAP_REG (HAPTIC_BASE + 0x58)
-#define QPNP_HAP_BRAKE_REG (HAPTIC_BASE + 0x5C)
-#define QPNP_HAP_PLAY_REG (HAPTIC_BASE + 0x70)
+#define HAPTIC_BASE(s_id) (s_id ? (PMI_SECOND_SLAVE_ADDR_BASE + 0xC000):((PMI_SECOND_SLAVE_OFFSET << 16) + 0xC000))
+#define QPNP_HAP_EN_CTL_REG(s_id) (HAPTIC_BASE(s_id) + 0x46)
+#define QPNP_HAP_EN_CTL2_REG(s_id) (HAPTIC_BASE(s_id) + 0x48)
+#define QPNP_HAP_ACT_TYPE_REG(s_id) (HAPTIC_BASE(s_id) + 0x4C)
+#define QPNP_HAP_WAV_SHAPE_REG(s_id) (HAPTIC_BASE(s_id) + 0x4D)
+#define QPNP_HAP_PLAY_MODE_REG(s_id) (HAPTIC_BASE(s_id) + 0x4E)
+#define QPNP_HAP_LRA_AUTO_RES_REG(s_id) (HAPTIC_BASE(s_id) + 0x4F)
+#define QPNP_HAP_VMAX_REG(s_id) (HAPTIC_BASE(s_id) + 0x51)
+#define QPNP_HAP_ILIM_REG(s_id) (HAPTIC_BASE(s_id) + 0x52)
+#define QPNP_HAP_SC_DEB_REG(s_id) (HAPTIC_BASE(s_id) + 0x53)
+#define QPNP_HAP_RATE_CFG1_REG(s_id) (HAPTIC_BASE(s_id) + 0x54)
+#define QPNP_HAP_RATE_CFG2_REG(s_id) (HAPTIC_BASE(s_id) + 0x55)
+#define QPNP_HAP_INT_PWM_REG(s_id) (HAPTIC_BASE(s_id) + 0x56)
+#define QPNP_HAP_PWM_CAP_REG(s_id) (HAPTIC_BASE(s_id) + 0x58)
+#define QPNP_HAP_BRAKE_REG(s_id) (HAPTIC_BASE(s_id) + 0x5C)
+#define QPNP_HAP_PLAY_REG(s_id) (HAPTIC_BASE(s_id) + 0x70)
#define QPNP_HAP_ACT_TYPE_MASK 0x01
#define QPNP_HAP_PLAY_MODE_MASK 0x3F
@@ -86,79 +87,90 @@
void pm_haptic_vib_turn_on(void)
{
struct qpnp_hap vib_config = {0};
+ uint32_t pmic = target_get_pmic();
+ uint32_t slave_id = 1;
- if(!target_is_pmi_enabled())
+ if(!target_is_pmi_enabled() && (pmic != PMIC_IS_PM660))
return;
+ if (pmic == PMIC_IS_PM660)
+ slave_id = 0;
+
get_vibration_type(&vib_config);
/* Configure the ACTUATOR TYPE register as ERM*/
- pmic_spmi_reg_mask_write(QPNP_HAP_ACT_TYPE_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_ACT_TYPE_REG(slave_id),
QPNP_HAP_ACT_TYPE_MASK,
VIB_ERM_TYPE == vib_config.vib_type ? QPNP_HAP_ERM
: QPNP_HAP_LRA);
/* Disable auto resonance for ERM */
- pmic_spmi_reg_mask_write(QPNP_HAP_LRA_AUTO_RES_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_LRA_AUTO_RES_REG(slave_id),
QPNP_HAP_LRA_AUTO_MASK,
QPNP_HAP_LRA_AUTO_DISABLE);
/* Configure the PLAY MODE register as direct*/
- pmic_spmi_reg_mask_write(QPNP_HAP_PLAY_MODE_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_PLAY_MODE_REG(slave_id),
QPNP_HAP_PLAY_MODE_MASK,
QPNP_HAP_DIRECT);
/* Configure the VMAX register */
- pmic_spmi_reg_mask_write(QPNP_HAP_VMAX_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_VMAX_REG(slave_id),
QPNP_HAP_VMAX_MASK, QPNP_HAP_VMAX);
/* Sets current limit to 800mA*/
- pmic_spmi_reg_mask_write(QPNP_HAP_ILIM_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_ILIM_REG(slave_id),
QPNP_HAP_ILIM_MASK, QPNP_HAP_ILIM);
/* Configure the short circuit debounce register as DEB_8CLK*/
- pmic_spmi_reg_mask_write(QPNP_HAP_SC_DEB_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_SC_DEB_REG(slave_id),
QPNP_HAP_SC_DEB_MASK, QPNP_HAP_SC_DEB_8CLK);
/* Configure the INTERNAL_PWM register as 505KHZ and 13PF*/
- pmic_spmi_reg_mask_write(QPNP_HAP_INT_PWM_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_INT_PWM_REG(slave_id),
QPNP_HAP_INT_PWM_MASK, QPNP_HAP_INT_PWM_505KHZ);
- pmic_spmi_reg_mask_write(QPNP_HAP_PWM_CAP_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_PWM_CAP_REG(slave_id),
QPNP_HAP_PWM_CAP_MASK, QPNP_HAP_PWM_CAP_13PF);
/* Configure the WAVE SHAPE register as SQUARE*/
- pmic_spmi_reg_mask_write(QPNP_HAP_WAV_SHAPE_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_WAV_SHAPE_REG(slave_id),
QPNP_HAP_WAV_SHAPE_MASK, QPNP_HAP_WAV_SHAPE_SQUARE);
/* Configure RATE_CFG1 and RATE_CFG2 registers for haptic rate. */
- pmic_spmi_reg_mask_write(QPNP_HAP_RATE_CFG1_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_RATE_CFG1_REG(slave_id),
QPNP_HAP_RATE_CFG1_MASK, vib_config.hap_rate_cfg1);
- pmic_spmi_reg_mask_write(QPNP_HAP_RATE_CFG2_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_RATE_CFG2_REG(slave_id),
QPNP_HAP_RATE_CFG2_MASK, vib_config.hap_rate_cfg2);
/* Configure BRAKE register, PATTERN1 & PATTERN2 as VMAX. */
- pmic_spmi_reg_mask_write(QPNP_HAP_EN_CTL2_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_EN_CTL2_REG(slave_id),
QPNP_HAP_EN_BRAKE_EN_MASK, QPNP_HAP_EN_BRAKING_EN);
- pmic_spmi_reg_mask_write(QPNP_HAP_BRAKE_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_BRAKE_REG(slave_id),
QPNP_HAP_BRAKE_VMAX_MASK, QPNP_HAP_BRAKE_VMAX);
/* Enable control register */
- pmic_spmi_reg_mask_write(QPNP_HAP_EN_CTL_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_EN_CTL_REG(slave_id),
QPNP_HAP_PLAY_MASK, QPNP_HAP_PLAY_EN);
/* Enable play register */
- pmic_spmi_reg_mask_write(QPNP_HAP_PLAY_REG, QPNP_HAP_MASK, QPNP_HAP_EN);
+ pmic_spmi_reg_mask_write(QPNP_HAP_PLAY_REG(slave_id), QPNP_HAP_MASK, QPNP_HAP_EN);
}
/* Turn off vibrator */
void pm_haptic_vib_turn_off(void)
{
- if(!target_is_pmi_enabled())
+ uint32_t pmic = target_get_pmic();
+ uint32_t slave_id = 1;
+
+ if(!target_is_pmi_enabled() && (pmic != PMIC_IS_PM660))
return;
+ if (pmic == PMIC_IS_PM660)
+ slave_id = 0;
+
/* Disable control register */
- pmic_spmi_reg_mask_write(QPNP_HAP_EN_CTL_REG,
+ pmic_spmi_reg_mask_write(QPNP_HAP_EN_CTL_REG(slave_id),
QPNP_HAP_PLAY_MASK, QPNP_HAP_PLAY_DIS);
/* Disable play register */
- pmic_spmi_reg_mask_write(QPNP_HAP_PLAY_REG, QPNP_HAP_MASK, QPNP_HAP_DIS);
+ pmic_spmi_reg_mask_write(QPNP_HAP_PLAY_REG(slave_id), QPNP_HAP_MASK, QPNP_HAP_DIS);
}
diff --git a/include/platform.h b/include/platform.h
index 64f683d..6010a26 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
- * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
@@ -74,6 +74,7 @@
int platform_is_msm8956();
int platform_is_sdm429();
int platform_is_sdm439();
+int platform_is_sdm429w();
uint32_t platform_is_msm8976_v_1_1();
uint32_t platform_get_tz_app_add();
uint32_t platform_get_tz_app_size();
diff --git a/include/target.h b/include/target.h
index 0a0e545..d4b2416 100644
--- a/include/target.h
+++ b/include/target.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
- * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017,2019 The Linux Foundation. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
@@ -104,6 +104,7 @@
void pmic_reset_configure(uint8_t reset_type);
bool is_display_disabled(void);
bool target_uses_system_as_root(void);
+bool target_dynamic_partition_supported(void);
struct qmp_reg *target_get_qmp_settings();
int target_get_qmp_regsize();
uint32_t target_ddr_cfg_reg();
diff --git a/makefile b/makefile
index f6da064..9822cc5 100644
--- a/makefile
+++ b/makefile
@@ -127,6 +127,10 @@
DEFINES += _SIGNED_KERNEL=1
endif
+ifeq ($(DYNAMIC_PARTITION_SUPPORT),1)
+ DEFINES += DYNAMIC_PARTITION_SUPPORT=1
+endif
+
ifeq ($(TARGET_DTBO_NOT_SUPPORTED),1)
DEFINES += TARGET_DTBO_NOT_SUPPORTED=1
endif
diff --git a/platform/init.c b/platform/init.c
index 46f934c..0488c53 100644
--- a/platform/init.c
+++ b/platform/init.c
@@ -28,6 +28,9 @@
#include <boot_stats.h>
#include <platform/iomap.h>
#include <image_verify.h>
+#include <target.h>
+#include <boot_device.h>
+#include <mmc_wrapper.h>
/*
* default implementations of these routines, if the platform code
@@ -147,7 +150,7 @@
return 0;
}
-__WEAK uint32_t use_hsonly_mode()
+__WEAK bool use_hsonly_mode()
{
return 0;
}
@@ -178,3 +181,24 @@
#endif
}
+/* function to update boot device base, for emmc targets. */
+__WEAK void platform_boot_dev_cmdline(char *buf)
+{
+ struct mmc_device *dev = NULL;
+ uint32_t boot_dev_str_sz = 0;
+
+ if (!buf) {
+ dprintf(CRITICAL,"ERROR: Invalid args- Failed to populate boot device");
+ return;
+ }
+
+ dev = (struct mmc_device *)target_mmc_device();
+ boot_dev_str_sz = ((sizeof(dev->host.base))*2) + 7;
+ if (boot_dev_str_sz > sizeof(char) * BOOT_DEV_MAX_LEN) {
+ dprintf(CRITICAL,"ERROR: Invalid buf sz - Failed to populate boot device");
+ return;
+ }
+
+ snprintf(buf, boot_dev_str_sz, "%x.sdhci", dev->host.base);
+ return;
+}
diff --git a/platform/msm8952/platform.c b/platform/msm8952/platform.c
index 6fa24f2..2b5bdcf 100644
--- a/platform/msm8952/platform.c
+++ b/platform/msm8952/platform.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, 2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2016, 2018-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
@@ -313,6 +313,22 @@
return ret;
}
+int platform_is_sdm429w()
+{
+ uint32_t platform = board_platform_id();
+ uint32_t ret = 0;
+
+ switch(platform)
+ {
+ case SDM429W:
+ ret = 1;
+ break;
+ default:
+ ret = 0;
+ };
+
+ return ret;
+}
int platform_is_msm8956()
{
diff --git a/platform/msm_shared/avb/VerifiedBoot.c b/platform/msm_shared/avb/VerifiedBoot.c
index 19ebe4d..642747d 100644
--- a/platform/msm_shared/avb/VerifiedBoot.c
+++ b/platform/msm_shared/avb/VerifiedBoot.c
@@ -430,7 +430,8 @@
SlotSuffix = "\0";
}
- if(!Info->multi_slot_boot && Info->bootinto_recovery) {
+ if((!Info->multi_slot_boot || target_dynamic_partition_supported())
+ && Info->bootinto_recovery) {
AddRequestedPartition(RequestedPartitionAll, IMG_RECOVERY);
NumRequestedPartition += 1;
/* Add dtbo validation if target supports dtbo image generation and
@@ -538,7 +539,7 @@
Info->vb_data = (VOID *)VBData;
ImageHdrSize = get_page_size();
- GUARD_OUT(getimage(&image_buffer, &imgsize,(!Info->multi_slot_boot && Info->bootinto_recovery) ? "recovery" : "boot") );
+ GUARD_OUT(getimage(&image_buffer, &imgsize,((!Info->multi_slot_boot || target_dynamic_partition_supported()) && Info->bootinto_recovery) ? "recovery" : "boot") );
Status = check_img_header(image_buffer, ImageHdrSize, &imgsizeActual);
if (Status != EFI_SUCCESS) {
diff --git a/platform/msm_shared/avb/libavb/avb_ops.h b/platform/msm_shared/avb/libavb/avb_ops.h
index 4899b95..a74e1c0 100644
--- a/platform/msm_shared/avb/libavb/avb_ops.h
+++ b/platform/msm_shared/avb/libavb/avb_ops.h
@@ -221,6 +221,9 @@
* (NUL-terminated UTF-8 string). Returns the value in
* |out_size_num_bytes|.
*
+ * If the partition doesn't exist the AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION
+ * error code should be returned.
+ *
* Returns AVB_IO_RESULT_OK on success, otherwise an error code.
*/
AvbIOResult (*get_size_of_partition)(AvbOps* ops,
diff --git a/platform/msm_shared/avb/libavb/avb_slot_verify.c b/platform/msm_shared/avb/libavb/avb_slot_verify.c
index 60d4a5f..e0049e6 100644
--- a/platform/msm_shared/avb/libavb/avb_slot_verify.c
+++ b/platform/msm_shared/avb/libavb/avb_slot_verify.c
@@ -138,13 +138,6 @@
*/
image_size = hash_desc.image_size;
if (allow_verification_error) {
- if (ops->get_size_of_partition == NULL) {
- avb_errorv(part_name,
- ": The get_size_of_partition() operation is "
- "not implemented so we may not load the entire partition. "
- "Please implement.",
- NULL);
- } else {
io_ret = ops->get_size_of_partition(ops, part_name, &image_size);
if (io_ret == AVB_IO_RESULT_ERROR_OOM) {
ret = AVB_SLOT_VERIFY_RESULT_ERROR_OOM;
@@ -155,7 +148,6 @@
goto out;
}
avb_debugv(part_name, ": Loading entire partition.\n", NULL);
- }
}
if (!strncmp(part_name, "boot", strlen("boot"))) {
@@ -272,12 +264,6 @@
uint8_t* image_buf = NULL;
size_t n;
- if (ops->get_size_of_partition == NULL) {
- avb_error("get_size_of_partition() not implemented.\n");
- ret = AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_ARGUMENT;
- goto out;
- }
-
for (n = 0; requested_partitions[n] != NULL; n++) {
char part_name[PART_NAME_MAX_SIZE];
AvbIOResult io_ret;
@@ -399,7 +385,7 @@
goto out;
}
- /* Construct full partition name. */
+ /* Construct full partition name e.g. system_a. */
if (!avb_str_concat(full_partition_name,
sizeof full_partition_name,
partition_name,
@@ -411,18 +397,17 @@
goto out;
}
- avb_debugv("Loading vbmeta struct from partition '",
- full_partition_name,
- "'.\n",
- NULL);
-
- /* If we're loading from the main vbmeta partition, the vbmeta
- * struct is in the beginning. Otherwise we have to locate it via a
- * footer.
+ /* If we're loading from the main vbmeta partition, the vbmeta struct is in
+ * the beginning. Otherwise we may have to locate it via a footer... if no
+ * footer is found, we look in the beginning to support e.g. vbmeta_<org>
+ * partitions holding data for e.g. super partitions (b/80195851 for
+ * rationale).
*/
+
+
+ vbmeta_offset = 0;
+ vbmeta_size = VBMETA_MAX_SIZE;
if (is_vbmeta_partition) {
- vbmeta_offset = 0;
- vbmeta_size = VBMETA_MAX_SIZE;
io_ret = ops->read_from_partition(ops,
partition_name,
vbmeta_offset,
@@ -456,20 +441,18 @@
if (!avb_footer_validate_and_byteswap((const AvbFooter*)footer_buf,
&footer)) {
- avb_errorv(full_partition_name, ": Error validating footer.\n", NULL);
- ret = AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA;
- goto out;
+ 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);
+ } 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);
- ret = AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA;
- goto out;
- }
- 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;
@@ -951,6 +934,14 @@
char part_name[PART_NAME_MAX_SIZE];
char guid_buf[37];
+ /* Don't attempt to query the partition guid unless its search string is
+ * present in the command line. Note: the original cmdline is used here,
+ * not the replaced one.
+ */
+ if (avb_strstr (cmdline, replace_str[n]) == NULL) {
+ continue;
+ }
+
if (!avb_str_concat(part_name,
sizeof part_name,
part_name_str[n],
@@ -1299,13 +1290,10 @@
bool allow_verification_error =
(flags & AVB_SLOT_VERIFY_FLAGS_ALLOW_VERIFICATION_ERROR);
- /* Fail early if we're missing the AvbOps needed for slot verification.
- *
- * For now, handle get_size_of_partition() not being implemented. In
- * a later release we may change that.
- */
+ /* Fail early if we're missing the AvbOps needed for slot verification.*/
avb_assert(ops->read_is_device_unlocked != NULL);
avb_assert(ops->read_from_partition != NULL);
+ avb_assert(ops->get_size_of_partition != NULL);
avb_assert(ops->validate_vbmeta_public_key != NULL);
avb_assert(ops->read_rollback_index != NULL);
avb_assert(ops->get_unique_guid_for_partition != NULL);
diff --git a/platform/msm_shared/dev_tree.c b/platform/msm_shared/dev_tree.c
index 5ad8faf..fa7b28a 100644
--- a/platform/msm_shared/dev_tree.c
+++ b/platform/msm_shared/dev_tree.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015,2017-2018 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015,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
@@ -49,7 +49,6 @@
#include <boot_stats.h>
#include <verifiedboot.h>
-#define BOOT_DEV_MAX_LEN 64
#define NODE_PROPERTY_MAX_LEN 64
#define ADD_OF(a, b) (UINT_MAX - b > a) ? (a + b) : UINT_MAX
#define ADDR_ALIGNMENT 16
@@ -75,7 +74,7 @@
uint32_t size;
};
-#if ENABLE_BOOTDEVICE_MOUNT
+#if ENABLE_BOOTDEVICE_MOUNT || DYNAMIC_PARTITION_SUPPORT
/* Look up table for fstab node */
struct fstab_node
{
@@ -84,6 +83,11 @@
const char *device_path_id;
};
+static struct fstab_node dynamic_fstab_table =
+{
+ "/firmware/android/fstab", "status", ""
+};
+
static struct fstab_node fstab_table =
{
"/firmware/android/fstab", "dev", "/soc/"
@@ -2102,7 +2106,7 @@
}
}
-#if ENABLE_BOOTDEVICE_MOUNT
+#if ENABLE_BOOTDEVICE_MOUNT || DYNAMIC_PARTITION_SUPPORT
/* Update fstab node */
dprintf(SPEW, "Start of fstab node update:%zu ms\n", platform_get_sclk_count());
if (update_fstab_node(fdt) != 0) {
@@ -2120,7 +2124,7 @@
return ret;
}
-#if ENABLE_BOOTDEVICE_MOUNT
+#if ENABLE_BOOTDEVICE_MOUNT || DYNAMIC_PARTITION_SUPPORT
/*Update device tree for fstab node */
static int update_fstab_node(void *fdt)
{
@@ -2136,39 +2140,60 @@
char *prefix_str = NULL;
char *suffix_str = NULL;
const struct fdt_property *prop = NULL;
+ struct fstab_node table = target_dynamic_partition_supported() ?
+ dynamic_fstab_table :
+ fstab_table;
/* Find the parent node */
- parent_offset = fdt_path_offset(fdt, fstab_table.parent_node);
+ parent_offset = fdt_path_offset(fdt, table.parent_node);
if (parent_offset < 0) {
dprintf(CRITICAL, "Failed to get parent node: fstab error: %d\n", parent_offset);
return -1;
}
dprintf(SPEW, "Node: %s found.\n", fdt_get_name(fdt, parent_offset, NULL));
- /* Get boot device type */
- boot_dev_buf = (char *) malloc(sizeof(char) * BOOT_DEV_MAX_LEN);
- if (!boot_dev_buf) {
- dprintf(CRITICAL, "Failed to allocate memory for boot device\n");
- return -1;
+ if (!target_dynamic_partition_supported())
+ {
+ /* Get boot device type */
+ boot_dev_buf = (char *) malloc(sizeof(char) * BOOT_DEV_MAX_LEN);
+ if (!boot_dev_buf) {
+ dprintf(CRITICAL, "Failed to allocate memory for boot device\n");
+ return -1;
+ }
+
+ new_str = (char *) malloc(sizeof(char) * NODE_PROPERTY_MAX_LEN);
+ if (!new_str) {
+ dprintf(CRITICAL, "Failed to allocate memory for node property string\n");
+ return -1;
+ }
+
+ platform_boot_dev_cmdline(boot_dev_buf);
}
- new_str = (char *) malloc(sizeof(char) * NODE_PROPERTY_MAX_LEN);
- if (!new_str) {
- dprintf(CRITICAL, "Failed to allocate memory for node property string\n");
- return -1;
- }
-
-
- platform_boot_dev_cmdline(boot_dev_buf);
-
/* Get properties of all sub nodes */
- for (subnode_offset = fdt_first_subnode(fdt, parent_offset); subnode_offset >= 0; subnode_offset = fdt_next_subnode(fdt, subnode_offset)) {
- prop = fdt_get_property(fdt, subnode_offset, fstab_table.node_prop, &prop_length);
+ for (subnode_offset = fdt_first_subnode(fdt, parent_offset);
+ subnode_offset >= 0;
+ subnode_offset = fdt_next_subnode(fdt, subnode_offset)) {
+ prop = fdt_get_property(fdt, subnode_offset, table.node_prop, &prop_length);
node_name = (char *)(uintptr_t)fdt_get_name(fdt, subnode_offset, NULL);
if (!prop) {
- dprintf(CRITICAL, "Property:%s is not found for sub node:%s\n", fstab_table.node_prop, node_name);
+ dprintf(CRITICAL, "Property:%s is not found for sub node:%s\n", table.node_prop, node_name);
} else {
- dprintf(CRITICAL, "Property:%s found for sub node:%s\tproperty:%s\n", fstab_table.node_prop, node_name, prop->data);
+ dprintf(CRITICAL, "Property:%s found for sub node:%s\tproperty:%s\n", table.node_prop, node_name, prop->data);
+
+ /* For Dynamic partition support disable firmware fstab nodes. */
+ if (target_dynamic_partition_supported())
+ {
+ dprintf (INFO, "Disabling node status :%s\n", node_name);
+ ret = fdt_setprop (fdt, subnode_offset, table.node_prop, "disabled",
+ (strlen("disabled") + 1));
+ if (ret)
+ {
+ dprintf(CRITICAL, "ERROR: Failed to disable Node: %s\n", node_name);
+ }
+ continue;
+ }
+
/* Pointer to fdt 'dev' property string that needs to update based on the 'androidboot.bootdevice' */
memset(new_str, 0, NODE_PROPERTY_MAX_LEN);
prefix_str = (char *)prop->data;
@@ -2176,12 +2201,12 @@
dprintf(CRITICAL, "Property string length is greater than node property max length\n");
continue;
}
- suffix_str = strstr(prefix_str, fstab_table.device_path_id);
+ suffix_str = strstr(prefix_str, table.device_path_id);
if (!suffix_str) {
dprintf(CRITICAL, "Property is not proper to update\n");
continue;
}
- suffix_str += strlen(fstab_table.device_path_id);
+ suffix_str += strlen(table.device_path_id);
prefix_string_len = strlen(prefix_str) - (strlen(suffix_str) - 1);
suffix_str = strstr((suffix_str + 1), "/");
str_len = strlcpy(new_str, prefix_str, prefix_string_len);
@@ -2202,7 +2227,7 @@
/* Update the new property in the memory */
memscpy(prefix_str, strlen(prefix_str), new_str, strlen(new_str) + 1);
/* Update the property with new value */
- ret = fdt_setprop(fdt, subnode_offset, fstab_table.node_prop, (const void *)prefix_str, strlen(prefix_str) + 1);
+ ret = fdt_setprop(fdt, subnode_offset, table.node_prop, (const void *)prefix_str, strlen(prefix_str) + 1);
if(ret) {
dprintf(CRITICAL, "Failed to update the node with new property\n");
continue;
diff --git a/platform/msm_shared/include/boot_device.h b/platform/msm_shared/include/boot_device.h
index a0897ec..4e281f7 100644
--- a/platform/msm_shared/include/boot_device.h
+++ b/platform/msm_shared/include/boot_device.h
@@ -1,4 +1,4 @@
-/* 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 are
@@ -59,6 +59,7 @@
#ifndef MAX_GPT_NAME_SIZE
#define MAX_GPT_NAME_SIZE 72
#endif
+#define BOOT_DEV_MAX_LEN 64
typedef struct {
char *name;
diff --git a/platform/msm_shared/reboot.c b/platform/msm_shared/reboot.c
index d9a1310..7be94cd 100644
--- a/platform/msm_shared/reboot.c
+++ b/platform/msm_shared/reboot.c
@@ -37,18 +37,33 @@
#include <stdlib.h>
#include <reboot.h>
#include <qtimer.h>
+#include <smem.h>
#if USER_FORCE_RESET_SUPPORT
/* Return 1 if it is a force resin triggered by user. */
uint32_t is_user_force_reset(void)
{
- uint8_t poff_reason1 = pm8x41_get_pon_poff_reason1();
- uint8_t poff_reason2 = pm8x41_get_pon_poff_reason2();
+ uint8_t poff_reason1;
+ uint8_t poff_reason2;
+ uint8_t is_cold_boot;
+ uint32_t pmic = target_get_pmic();
+ bool s3_reset;
+
+ if (pmic == PMIC_IS_PM660) {
+ poff_reason1 = pm660_get_pon_poff_reason1();
+ poff_reason2 = pm660_get_pon_poff_reason2();
+ is_cold_boot = pm660_get_is_cold_boot();
+ s3_reset = (poff_reason2 == PM660_STAGE3);
+ } else {
+ poff_reason1 = pm8x41_get_pon_poff_reason1();
+ poff_reason2 = pm8x41_get_pon_poff_reason2();
+ is_cold_boot = pm8x41_get_is_cold_boot();
+ s3_reset = (poff_reason2 == STAGE3);
+ }
dprintf(SPEW, "poff_reason1: %d\n", poff_reason1);
dprintf(SPEW, "poff_reason2: %d\n", poff_reason2);
- if (pm8x41_get_is_cold_boot() && (poff_reason1 == KPDPWR_AND_RESIN ||
- poff_reason2 == STAGE3))
+ if (is_cold_boot && (poff_reason1 == KPDPWR_AND_RESIN || s3_reset))
return 1;
else
return 0;
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index ce035e6..1e63629 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -2,7 +2,7 @@
* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
- * Copyright (c) 2009-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-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
@@ -474,7 +474,8 @@
SDM439 = 353,
SDA429 = 364,
SDA439 = 363,
- QM215 = 386
+ QM215 = 386,
+ SDM429W = 416,
};
enum platform {
@@ -516,6 +517,7 @@
HW_PLATFORM_SUBTYPE_SVLTE2A = 3,
HW_PLATFORM_SUBTYPE_MTP_WEAR = 5,
HW_PLATFORM_SUBTYPE_SGLTE = 6,
+ HW_PLATFORM_SUBTYPE_429W_PM660 = 6,
HW_PLATFORM_SUBTYPE_DSDA = 7,
HW_PLATFORM_SUBTYPE_DSDA2 = 8,
HW_PLATFORM_SUBTYPE_SGLTE2 = 9,
diff --git a/target/init.c b/target/init.c
index c907da3..fa30f3e 100644
--- a/target/init.c
+++ b/target/init.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
- * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
@@ -278,6 +278,16 @@
return false;
}
+/* Check dynamic partition support is enabled for target */
+bool target_dynamic_partition_supported(void)
+{
+#if DYNAMIC_PARTITION_SUPPORT
+ return true;
+#else
+ return false;
+#endif
+}
+
/* Default CFG register value */
uint32_t target_ddr_cfg_reg()
{
@@ -395,6 +405,7 @@
case SDA429:
case SDA439:
case QM215:
+ case SDM429W:
config->vib_type = VIB_LRA_TYPE;
config->hap_rate_cfg1 = QPNP_HAP_RATE_CFG1_41;
config->hap_rate_cfg2 = QPNP_HAP_RATE_CFG2_03;
diff --git a/target/msm8952/init.c b/target/msm8952/init.c
index f779278..f0bd911 100644
--- a/target/msm8952/init.c
+++ b/target/msm8952/init.c
@@ -246,27 +246,32 @@
uint32_t target_is_pwrkey_pon_reason()
{
uint32_t pmic = target_get_pmic();
- uint8_t pon_reason = 0;
- bool usb_present_sts = 0;
+ uint8_t pon_reason;
+ uint8_t is_cold_boot;
+ bool usb_present_sts;
- if (pmic == PMIC_IS_PMI632)
- {
+ if (pmic == PMIC_IS_PMI632) {
pon_reason = pmi632_get_pon_reason();
+ is_cold_boot = pm8x41_get_is_cold_boot();
usb_present_sts = !(USBIN_UV_RT_STS_PMI632 &
pm8x41_reg_read(SMBCHG_USB_RT_STS));
- }
- else if (pmic == PMIC_IS_PM8916) {
+ } else if (pmic == PMIC_IS_PM8916) {
pon_reason = pm8x41_get_pon_reason();
+ is_cold_boot = pm8x41_get_is_cold_boot();
usb_present_sts = (pon_reason & USB_CHG);
- }
- else
- {
+ } else if (pmic == PMIC_IS_PM660) {
+ pon_reason = pm660_get_pon_reason();
+ is_cold_boot = pm660_get_is_cold_boot();
+ usb_present_sts = USBIN_PLUGIN_RT_STS &
+ pm8x41_reg_read(SCHG_USB_INT_RT_STS);
+ } else {
pon_reason = pm8950_get_pon_reason();
+ is_cold_boot = pm8x41_get_is_cold_boot();
usb_present_sts = !(USBIN_UV_RT_STS &
pm8x41_reg_read(SMBCHG_USB_RT_STS));
}
- if (pm8x41_get_is_cold_boot() && ((pon_reason == KPDPWR_N) || (pon_reason == (KPDPWR_N|PON1))))
+ if (is_cold_boot && ((pon_reason == KPDPWR_N) || (pon_reason == (KPDPWR_N|PON1))))
return 1;
else if ((pon_reason == PON1) && (!usb_present_sts))
return 1;
@@ -327,7 +332,7 @@
#if PON_VIB_SUPPORT
/* turn on vibrator to indicate that phone is booting up to end user */
- if(target_is_pmi_enabled() || platform_is_qm215())
+ if(target_is_pmi_enabled() || platform_is_qm215() || platform_is_sdm429w())
vib_timed_turn_on(VIBRATE_TIME);
#endif
@@ -453,22 +458,35 @@
unsigned target_pause_for_battery_charge(void)
{
uint32_t pmic = target_get_pmic();
- uint8_t pon_reason = pm8x41_get_pon_reason();
- uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
+ uint8_t pon_reason;
+ uint8_t is_cold_boot;
bool usb_present_sts = 1; /* don't care by default */
+ if (pmic == PMIC_IS_PM660) {
+ pon_reason = pm660_get_pon_reason();
+ is_cold_boot = pm660_get_is_cold_boot();
+ }
+ else {
+ pon_reason = pm8x41_get_pon_reason();
+ is_cold_boot = pm8x41_get_is_cold_boot();
+ }
+
if (target_is_pmi_enabled())
{
- if (pmic == PMIC_IS_PMI632)
+ if (pmic == PMIC_IS_PMI632) {
usb_present_sts = !(USBIN_UV_RT_STS_PMI632 &
pm8x41_reg_read(SMBCHG_USB_RT_STS));
- else
+ } else {
usb_present_sts = (!(USBIN_UV_RT_STS &
pm8x41_reg_read(SMBCHG_USB_RT_STS)));
+ }
}
else {
if (pmic == PMIC_IS_PM8916) {
usb_present_sts = (pon_reason & USB_CHG);
+ } else if (pmic == PMIC_IS_PM660) {
+ usb_present_sts = USBIN_PLUGIN_RT_STS &
+ pm8x41_reg_read(SCHG_USB_INT_RT_STS);
}
}
@@ -491,7 +509,7 @@
void target_uninit(void)
{
#if PON_VIB_SUPPORT
- if(target_is_pmi_enabled())
+ if(target_is_pmi_enabled() || platform_is_sdm429w())
turn_off_vib_early();
#endif
mmc_put_card_to_sleep(dev);
@@ -686,8 +704,8 @@
bool target_is_pmi_enabled(void)
{
- if(platform_is_qm215() || (platform_is_msm8917() &&
- (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_SAP_NOPMI)))
+ if (platform_is_qm215() || (platform_is_sdm429w()) || (platform_is_msm8917()
+ && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_SAP_NOPMI)))
return 0;
else
return 1;
@@ -742,7 +760,7 @@
else
return PMIC_IS_PMI8950;
} else {
- if (platform_is_qm215()) {
+ if (platform_is_qm215() || platform_is_sdm429w()) {
pmi_type = board_pmic_target(0) & PMIC_TYPE_MASK;
return pmi_type;
}
@@ -757,6 +775,8 @@
pmi_type = target_get_pmic();
if (pmi_type == PMIC_IS_PMI632) {
pmi632_reset_configure(reset_type);
+ } else if (pmi_type == PMIC_IS_PM660) {
+ pm8x41_reset_configure(reset_type);
} else {
if(target_is_pmi_enabled()) {
pm8994_reset_configure(reset_type);
diff --git a/target/msm8952/target_display.c b/target/msm8952/target_display.c
index 6c3b058..38cf975 100644
--- a/target/msm8952/target_display.c
+++ b/target/msm8952/target_display.c
@@ -275,7 +275,7 @@
uint8_t slave_id = PMIC_WLED_SLAVE_ID; /* pmi */
uint32_t pmic_type = target_get_pmic();
- if(pmic_type == PMIC_IS_PM8916)
+ if(pmic_type == PMIC_IS_PM8916 || pmic_type == PMIC_IS_PM660)
return NO_ERROR;
pm8x41_wled_config_slave_id(slave_id);
@@ -312,7 +312,7 @@
if ((pmic_type == PMIC_IS_PMI632) &&
(bl->bl_interface_type == BL_PWM)) {
ret = pwm_backlight_ctrl(enable);
- } else if (pmic_type == PMIC_IS_PM8916) {
+ } else if (pmic_type == PMIC_IS_PM8916 || pmic_type == PMIC_IS_PM660) {
ret = pwm_backlight_ctrl(enable);
} else {
ret = msm8952_wled_backlight_ctrl(enable);
@@ -536,7 +536,7 @@
int rc = NO_ERROR;
uint32_t pmic_type = target_get_pmic();
- if(pmic_type == PMIC_IS_PM8916)
+ if(pmic_type == PMIC_IS_PM8916 || pmic_type == PMIC_IS_PM660)
return NO_ERROR;
labibb = pinfo->labibb;
@@ -669,7 +669,7 @@
}
if (pmic_type == PMIC_IS_PMI632)
rc = qpnp_lcdb_enable(true);
- else if(pmic_type != PMIC_IS_PM8916)
+ else if(pmic_type != PMIC_IS_PM8916 && pmic_type != PMIC_IS_PM660)
rc = qpnp_ibb_enable(true); /*5V boost*/
if (rc) {
dprintf(CRITICAL, "%s: qpnp_ibb/lcdb failed\n", __func__);
diff --git a/target/msm8953/oem_panel.c b/target/msm8953/oem_panel.c
index 4de8664..2a21713 100644
--- a/target/msm8953/oem_panel.c
+++ b/target/msm8953/oem_panel.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016,2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016,2018-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
@@ -371,13 +371,13 @@
switch (hw_id) {
case HW_PLATFORM_MTP:
panel_id = TRULY_1080P_VIDEO_PANEL;
- if (platform_subtype == 0x03)
+ if (platform_subtype == 0x03 || platform_subtype == 0x04)
panel_id = HX8399C_FHD_PLUSE_VIDEO_PANEL;
break;
case HW_PLATFORM_SURF:
case HW_PLATFORM_RCM:
panel_id = TRULY_1080P_VIDEO_PANEL;
- if (platform_subtype == 0x02)
+ if (platform_subtype == 0x02 || platform_subtype == 0x03)
panel_id = HX8399C_FHD_PLUSE_VIDEO_PANEL;
break;
case HW_PLATFORM_QRD: