Merge "dev: gcdb: display: fix slight flicker for HD+ panel on SDM429"
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 671f6c7..10cae72 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -321,8 +321,8 @@
char display_panel_buf[MAX_PANEL_BUF_SIZE];
char panel_display_mode[MAX_RSP_SIZE];
char soc_version_str[MAX_RSP_SIZE];
-#if PRODUCT_IOT
char block_size_string[MAX_RSP_SIZE];
+#if PRODUCT_IOT
/* For IOT we are using custom version */
#define PRODUCT_IOT_VERSION "IOT001"
@@ -1277,7 +1277,7 @@
{
write_device_info_mmc(&device);
#ifdef TZ_TAMPER_FUSE
- set_tamper_fuse_cmd();
+ set_tamper_fuse_cmd(HLOS_IMG_TAMPER_FUSE);
#endif
#ifdef ASSERT_ON_TAMPER
dprintf(CRITICAL, "Device is tampered. Asserting..\n");
@@ -4700,17 +4700,24 @@
device.display_panel);
fastboot_publish("display-panel",
(const char *) panel_display_mode);
+
+ if (target_is_emmc_boot())
+ {
+ mmc_blocksize = mmc_get_device_blocksize();
+ }
+ else
+ {
+ mmc_blocksize = flash_block_size();
+ }
+ snprintf(block_size_string, MAX_RSP_SIZE, "0x%x", mmc_blocksize);
+ fastboot_publish("erase-block-size", (const char *) block_size_string);
+ fastboot_publish("logical-block-size", (const char *) block_size_string);
#if PRODUCT_IOT
get_bootloader_version_iot(&bootloader_version_string);
fastboot_publish("version-bootloader", (const char *) bootloader_version_string);
/* Version baseband is n/a for apq iot devices */
fastboot_publish("version-baseband", "N/A");
-
- /* IOT targets support only mmc target */
- snprintf(block_size_string, MAX_RSP_SIZE, "0x%x", mmc_get_device_blocksize());
- fastboot_publish("erase-block-size", (const char *) block_size_string);
- fastboot_publish("logical-block-size", (const char *) block_size_string);
#else
fastboot_publish("version-bootloader", (const char *) device.bootloader_version);
fastboot_publish("version-baseband", (const char *) device.radio_version);
@@ -4889,7 +4896,7 @@
if((device.is_unlocked) || (device.is_tampered))
{
#ifdef TZ_TAMPER_FUSE
- set_tamper_fuse_cmd();
+ set_tamper_fuse_cmd(HLOS_IMG_TAMPER_FUSE);
#endif
#if USE_PCOM_SECBOOT
set_tamper_flag(device.is_tampered);
diff --git a/platform/msm_shared/avb/VerifiedBoot.c b/platform/msm_shared/avb/VerifiedBoot.c
index fc14754..4150f9a 100644
--- a/platform/msm_shared/avb/VerifiedBoot.c
+++ b/platform/msm_shared/avb/VerifiedBoot.c
@@ -476,7 +476,7 @@
}
if (Info->num_loaded_images < NumRequestedPartition) {
- dprintf(CRITICAL, "ERROR: AvbSlotVerify slot data: num of loaded partitions %d, requested %lu\n",Info->num_loaded_images, NumRequestedPartition);
+ dprintf(CRITICAL, "ERROR: AvbSlotVerify slot data: num of loaded partitions %d, requested %llu\n",Info->num_loaded_images, NumRequestedPartition);
Status = EFI_LOAD_ERROR;
goto out;
}
diff --git a/platform/msm_shared/avb/libavb/avb_ops.c b/platform/msm_shared/avb/libavb/avb_ops.c
index d8416ab..ebb84c7 100644
--- a/platform/msm_shared/avb/libavb/avb_ops.c
+++ b/platform/msm_shared/avb/libavb/avb_ops.c
@@ -186,7 +186,7 @@
ptn = partition_get_offset(index);
if (ReadOffset < 0) {
- if ((-ReadOffset) > ptn) {
+ if ((-ReadOffset) > (int64_t)ptn) {
dprintf(CRITICAL,
"Negative Offset outside range.\n");
Result = AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION;
@@ -211,7 +211,7 @@
}
dprintf(CRITICAL,
- "read from %s, 0x%x bytes at Offset 0x%x, partition size %lu\n",
+ "read from %s, 0x%x bytes at Offset 0x%x, partition size %llu\n",
Partition, NumBytes, Offset, ptn);
/* |NumBytes| and or |Offset| can be unaligned to block size/page size.
@@ -243,14 +243,14 @@
}
dprintf(DEBUG,
- "StartBlock 0x%x, ReadOffset 0x%x, read_size 0x%lx\n",
+ "StartBlock 0x%x, ReadOffset 0x%x, read_size 0x%llx\n",
StartBlock, StartPageReadOffset, StartPageReadSize);
if (StartPageReadSize <= 0 || StartPageReadOffset >= PageSize ||
StartPageReadSize > PageSize - StartPageReadOffset ||
StartPageReadSize > NumBytes) {
dprintf(CRITICAL,
"StartBlock 0x%x, ReadOffset 0x%x, read_size "
- "0x%lx outside range.\n",
+ "0x%llx outside range.\n",
StartBlock, StartPageReadOffset, StartPageReadSize);
Result = AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION;
goto out;
@@ -276,14 +276,14 @@
UINTN LastPageReadSize = (Offset + NumBytes) - ReadOffset2;
dprintf(DEBUG,
- "LastBlock 0x%x, ReadOffset 0x%x, read_size 0x%lx\n",
+ "LastBlock 0x%x, ReadOffset 0x%x, read_size 0x%llx\n",
LastBlock, LastPageReadOffset, LastPageReadSize);
if (LastPageReadSize <= 0 || LastPageReadSize >= PageSize ||
LastPageReadSize > (NumBytes - *OutNumRead)) {
dprintf(CRITICAL,
"LastBlock 0x%x, ReadOffset 0x%x, read_size "
- "0x%lx outside range.\n",
+ "0x%llx outside range.\n",
LastBlock, LastPageReadOffset, LastPageReadSize);
Result = AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION;
goto out;
@@ -309,14 +309,14 @@
(NumBytes - StartPageReadSize) < FillPageReadSize) {
dprintf(CRITICAL,
"FullBlock 0x%x, ReadOffset 0x%x, read_size "
- "0x%lx outside range.\n",
+ "0x%llx outside range.\n",
FullBlock, 0, FillPageReadSize);
Result = AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION;
goto out;
}
dprintf(SPEW,
"FullBlock 0x%x, ReadOffset 0x%x, read_size "
- "0x%lx outside range. StartPageReadSize %#lx PageSize %d ptn %#lx Buffer %p\n",
+ "0x%llx outside range. StartPageReadSize %#llx PageSize %d ptn %#llx Buffer %p\n",
FullBlock, 0, FillPageReadSize, StartPageReadSize, PageSize, ptn, Buffer);
Status = mmc_read(ptn + FullBlock * PageSize, Buffer + StartPageReadSize,
FillPageReadSize);
diff --git a/platform/msm_shared/boot_verifier.c b/platform/msm_shared/boot_verifier.c
index b89e792..2f5e2ff 100644
--- a/platform/msm_shared/boot_verifier.c
+++ b/platform/msm_shared/boot_verifier.c
@@ -462,6 +462,8 @@
km_set_rot_req_t *read_req = NULL;
km_set_rot_rsp_t read_rsp;
app_handle = get_secapp_handle();
+ uint32_t version = 0;
+
int n = 0, e = 0;
switch (boot_device_state)
{
@@ -572,12 +574,36 @@
memscpy(boot_state_info.public_key, sizeof(boot_state_info.public_key), digest, 32);
boot_verify_send_boot_state(&boot_state_info);
#endif
- dprintf(SPEW, "Sending Root of Trust to trustzone: end\n");
+ if ( is_secure_boot_enable()
+ && (dev_boot_state != GREEN))
+ {
+ version = qseecom_get_version();
+ if(allow_set_fuse(version)) {
+ ret = set_tamper_fuse_cmd(HLOS_IMG_TAMPER_FUSE);
+ if (ret) {
+ ret = false;
+ goto err;
+ }
+ ret = set_tamper_fuse_cmd(HLOS_TAMPER_NOTIFY_FUSE);
+ if (ret) {
+ dprintf(CRITICAL, "QCOM_VB_SendROT: set_tamper_fuse_cmd (TZ_HLOS_TAMPER_NOTIFY_FUSE) fails!\n");
+ ret = false;
+ goto err;
+ }
+ } else {
+ dprintf(CRITICAL, "QCOM_VB_SendROT: TZ didn't support this feature! Version: major = %d, minor = %d, patch = %d\n", (version >> 22) & 0x3FF, (version >> 12) & 0x3FF, version & 0x3FF);
+ ret = false;
+ goto err;
+ }
+ }
+ dprintf(CRITICAL, "Sending Root of Trust to trustzone: end\n");
+ ret = true;
+err:
if(input)
free(input);
free(read_req);
free(rot_input);
- return true;
+ return ret;
}
unsigned char* get_boot_fingerprint(unsigned int* buf_size)
diff --git a/platform/msm_shared/include/scm.h b/platform/msm_shared/include/scm.h
index 8c482a4..5abbe63 100644
--- a/platform/msm_shared/include/scm.h
+++ b/platform/msm_shared/include/scm.h
@@ -332,7 +332,21 @@
#define SCM_QFPROM_READ_ROW_ID 0x05
#define HLOS_IMG_TAMPER_FUSE 0
-
+#define WINSECAPP_LOADED_FUSE 1 /**< Used by the WinSec application to prevent reloading. */
+#define UEFISECAPP_LOADED_FUSE 2 /**< Used by UefiSecApp to prevent
+ reloading. */
+#define OEM_FUSE_1 3 /**< Reserved fuse bit for OEMs. */
+#define OEM_FUSE_2 4 /**< Reserved fuse bit for OEMs. */
+#define OEM_FUSE_3 5 /**< Reserved fuse bit for OEMs. */
+#define OEM_FUSE_4 6 /**< Reserved fuse bit for OEMs. */
+#define OEM_FUSE_5 7 /**< Reserved fuse bit for OEMs. */
+#define OEM_FUSE_6 8 /**< Reserved fuse bit for OEMs. */
+#define OEM_FUSE_7 9 /**< Reserved fuse bit for OEMs. */
+#define OEM_FUSE_8 10 /**< Reserved fuse bit for OEMs. */
+#define HLOS_BL_MILESTONE_FUSE 11 /**< Used to notify the bootloader milestone call.*/
+#define HLOS_TAMPER_NOTIFY_FUSE 12 /**< Used to notify TZ that HLOS has been tampered.*/
+#define NUM_SW_FUSES 13 /**< Number of supported software fuses.
+ @newpage */
#define SCM_SVC_CE_CHN_SWITCH_ID 0x04
#define SCM_CE_CHN_SWITCH_ID 0x02
@@ -382,7 +396,7 @@
int mdtp_cipher_dip_cmd(uint8_t *in_buf, uint32_t in_buf_size, uint8_t *out_buf,
uint32_t out_buf_size, uint32_t direction);
-void set_tamper_fuse_cmd();
+uint32_t set_tamper_fuse_cmd(uint32_t fuse_id);
/**
* Reads the row data of the specified QFPROM row address.
@@ -470,4 +484,5 @@
uint32_t scm_io_write(uint32_t address, uint32_t val);
int is_scm_call_available(uint32_t svc_id, uint32_t cmd_id);
int scm_disable_sdi();
+bool allow_set_fuse(uint32_t version);
#endif
diff --git a/platform/msm_shared/include/verifiedboot.h b/platform/msm_shared/include/verifiedboot.h
index 9e16982..7534c14 100644
--- a/platform/msm_shared/include/verifiedboot.h
+++ b/platform/msm_shared/include/verifiedboot.h
@@ -105,7 +105,7 @@
typedef int16_t INT16;
typedef int32_t INT32;
typedef int64_t INT64;
-typedef uintptr_t UINTN;
+typedef uint64_t UINTN;
typedef enum {
VB_UNDEFINED_HASH = 0,
diff --git a/platform/msm_shared/scm.c b/platform/msm_shared/scm.c
index 2516e83..139c2f7 100644
--- a/platform/msm_shared/scm.c
+++ b/platform/msm_shared/scm.c
@@ -723,7 +723,7 @@
return ret;
}
-void set_tamper_fuse_cmd()
+uint32_t set_tamper_fuse_cmd(uint32_t fuse_id)
{
uint32_t svc_id;
uint32_t cmd_id;
@@ -732,8 +732,8 @@
void *resp_buf = NULL;
size_t resp_len = 0;
scmcall_arg scm_arg = {0};
+ int ret;
- uint32_t fuse_id = HLOS_IMG_TAMPER_FUSE;
cmd_buf = (void *)&fuse_id;
cmd_len = sizeof(fuse_id);
@@ -746,19 +746,18 @@
svc_id = SCM_SVC_FUSE;
cmd_id = SCM_BLOW_SW_FUSE_ID;
- scm_call(svc_id, cmd_id, cmd_buf, cmd_len, resp_buf, resp_len);
+ ret=scm_call(svc_id, cmd_id, cmd_buf, cmd_len, resp_buf, resp_len);
}
else
{
scm_arg.x0 = MAKE_SIP_SCM_CMD(SCM_SVC_FUSE, SCM_BLOW_SW_FUSE_ID);
- scm_arg.x1 = MAKE_SCM_ARGS(0x2,SMC_PARAM_TYPE_BUFFER_READWRITE,SMC_PARAM_TYPE_VALUE);
- scm_arg.x2 = (uint32_t) cmd_buf;
+ scm_arg.x1 = MAKE_SCM_ARGS(0x1,SMC_PARAM_TYPE_VALUE);
+ scm_arg.x2 = fuse_id;
scm_arg.x3 = cmd_len;
-
- scm_call2(&scm_arg, NULL);
-
+ ret=scm_call2(&scm_arg, NULL);
}
+ return ret;
}
uint8_t get_tamper_fuse_cmd()
@@ -1443,3 +1442,14 @@
return false;
}
#endif
+bool allow_set_fuse(uint32_t version)
+{
+ /*if((major > 4) || (major == 4 && minor > 0))*/
+ if((((version >> 22) & 0x3FF) > 4)
+ || (((version >> 22) & 0x3FF) == 4 && ((version >> 12) & 0x3FF) > 0))
+ {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
diff --git a/platform/msm_shared/secapp_loader.c b/platform/msm_shared/secapp_loader.c
index ad9cffd..c8e3de4 100644
--- a/platform/msm_shared/secapp_loader.c
+++ b/platform/msm_shared/secapp_loader.c
@@ -80,7 +80,7 @@
km_set_milestone_req_t req = {0};
km_set_milestone_rsp_t rsp = {0};
-
+ uint32_t version=0;
req.cmd_id = KEYMASTER_MILESTONE_CALL;
/* Milestone end command */
@@ -91,7 +91,19 @@
dprintf(CRITICAL, "Failed to send milestone end command: Error: %x\n", rsp.status);
return -1;
}
-
+ version = qseecom_get_version();
+ if(allow_set_fuse(version)) {
+ dprintf(CRITICAL, "HLOS_BL_MILESTONE_FUSE ");
+ ret = set_tamper_fuse_cmd(HLOS_BL_MILESTONE_FUSE);
+ if (ret) {
+ dprintf(CRITICAL, "QCOM_VB_Send_Milestone: set_tamper_fuse_cmd (HLOS_BL_MILESTONE_FUSE) fails!\n");
+ }
+ } else {
+ dprintf(CRITICAL, "QCOM_VB_Send_Milestone: TZ didn't support this feature! Version: major = %d, minor = %d, patch = %d\n",
+ (version >> 22) & 0x3FF, (version >> 12) & 0x3FF, version & 0x3FF);
+ return ret;
+ }
+ dprintf(CRITICAL, "Success ");
return 0;
}