platform, project, target: Enable qseecom and secapp loader for 8226
Add support to enable loading the secapp.
Change-Id: I64be632ec7f899537993119b912ba001afa43a9e
diff --git a/platform/msm8226/include/platform/iomap.h b/platform/msm8226/include/platform/iomap.h
index 5b537e8..c62b7c5 100644
--- a/platform/msm8226/include/platform/iomap.h
+++ b/platform/msm8226/include/platform/iomap.h
@@ -208,4 +208,15 @@
#define VIDEO_MODE_CTRL 0x010
#define HS_TIMER_CTRL 0x0BC
+/* RPMB send receive buffer needs to be mapped
+* * as device memory, define the start address
+* * and size in MB
+*/
+#define RPMB_SND_RCV_BUF 0x08000000
+#define RPMB_SND_RCV_BUF_SZ 0x1
+
+/* QSEECOM: Secure app region notification */
+#define APP_REGION_ADDR 0x3280000
+#define APP_REGION_SIZE 0x80000
+
#endif
diff --git a/platform/msm8226/platform.c b/platform/msm8226/platform.c
index 3a25699..379e350 100644
--- a/platform/msm8226/platform.c
+++ b/platform/msm8226/platform.c
@@ -54,6 +54,7 @@
/* Physical addr, Virtual addr, Size (in MB), Flags */
{ MEMBASE, MEMBASE, (MEMSIZE / MB), LK_MEMORY},
{ MSM_IOMAP_BASE, MSM_IOMAP_BASE, MSM_IOMAP_SIZE, IOMAP_MEMORY},
+ { RPMB_SND_RCV_BUF, RPMB_SND_RCV_BUF, RPMB_SND_RCV_BUF_SZ, IOMAP_MEMORY},
};
static struct smem_ram_ptable ram_ptable;
diff --git a/platform/msm_shared/rules.mk b/platform/msm_shared/rules.mk
index 8950869..0d2c077 100644
--- a/platform/msm_shared/rules.mk
+++ b/platform/msm_shared/rules.mk
@@ -143,7 +143,8 @@
$(LOCAL_DIR)/dev_tree.o \
$(LOCAL_DIR)/gpio.o \
$(LOCAL_DIR)/dload_util.o \
- $(LOCAL_DIR)/shutdown_detect.o
+ $(LOCAL_DIR)/shutdown_detect.o \
+ $(LOCAL_DIR)/qseecom_lk.o
endif
ifeq ($(PLATFORM),mpq8092)
diff --git a/project/msm8226.mk b/project/msm8226.mk
index 5109297..6d15113 100644
--- a/project/msm8226.mk
+++ b/project/msm8226.mk
@@ -14,6 +14,7 @@
EMMC_BOOT := 1
ENABLE_SDHCI_SUPPORT := 1
+ENABLE_SECAPP_LOADER := 1
#enable power on vibrator feature
ENABLE_PON_VIB_SUPPORT := true
diff --git a/target/msm8226/init.c b/target/msm8226/init.c
index da09390..1995c27 100644
--- a/target/msm8226/init.c
+++ b/target/msm8226/init.c
@@ -243,6 +243,7 @@
void target_init(void)
{
+ int ret = 0;
dprintf(INFO, "target_init()\n");
spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID);
@@ -250,14 +251,43 @@
target_keystatus();
target_sdc_init();
+ clock_ce_enable(SSD_CE_INSTANCE);
+ if (target_use_signed_kernel())
+ target_crypto_init_params();
+#if VERIFIED_BOOT
+ /* Initialize Qseecom */
+ ret = qseecom_init();
+
+ if (ret < 0)
+ {
+ dprintf(CRITICAL, "Failed to initialize qseecom, error: %d\n", ret);
+ ASSERT(0);
+ }
+
+ /* Start Qseecom */
+ ret = qseecom_tz_init();
+
+ if (ret < 0)
+ {
+ dprintf(CRITICAL, "Failed to start qseecom, error: %d\n", ret);
+ ASSERT(0);
+ }
+
+ /*
+ * Load the sec app for first time
+ */
+ if (load_sec_app() < 0)
+ {
+ dprintf(CRITICAL, "Failed to load App for verified\n");
+ ASSERT(0);
+ }
+#endif
shutdown_detect();
/* turn on vibrator to indicate that phone is booting up to end user */
vib_timed_turn_on(VIBRATE_TIME);
- if (target_use_signed_kernel())
- target_crypto_init_params();
}
/* Do any target specific intialization needed before entering fastboot mode */
@@ -418,14 +448,20 @@
mmc_put_card_to_sleep(dev);
+ clock_ce_disable(SSD_CE_INSTANCE);
if (crypto_initialized())
crypto_eng_cleanup();
- if (target_is_ssd_enabled())
- clock_ce_disable(SSD_CE_INSTANCE);
-
- /* Disable HC mode before jumping to kernel */
- sdhci_mode_disable(&dev->host);
+#if VERIFIED_BOOT
+ if (is_sec_app_loaded())
+ {
+ if (send_milestone_call_to_tz() < 0)
+ {
+ dprintf(CRITICAL, "Failed to send milestone call\n");
+ ASSERT(0);
+ }
+ }
+#endif
}
void target_usb_init(void)
diff --git a/target/msm8226/rules.mk b/target/msm8226/rules.mk
index d31f2bc..bccfa1a 100755
--- a/target/msm8226/rules.mk
+++ b/target/msm8226/rules.mk
@@ -6,14 +6,14 @@
PLATFORM := msm8226
MEMBASE := 0x0FF00000 # SDRAM
-MEMSIZE := 0x00100000 # 1MB
+MEMSIZE := 0x00200000 # 2MB
BASE_ADDR := 0x00000
TAGS_ADDR := BASE_ADDR+0x00000100
KERNEL_ADDR := BASE_ADDR+0x00008000
RAMDISK_ADDR := BASE_ADDR+0x01000000
-SCRATCH_ADDR := 0x10000000
+SCRATCH_ADDR := 0x10100000
DEFINES += DISPLAY_SPLASH_SCREEN=1
DEFINES += DISPLAY_TYPE_MIPI=1