Merge "target: msm8952: Add display support for MSM8952 Polaris target"
diff --git a/include/stdlib.h b/include/stdlib.h
index 4db77fa..22dcf4c 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
- * Copyright (c) 2013, 2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013, 2014-2015 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
@@ -51,7 +51,7 @@
/* allocate a buffer on the stack aligned and padded to the cpu's cache line size */
#define STACKBUF_DMA_ALIGN(var, size) \
- uint8_t __##var[(size) + CACHE_LINE]; uint8_t *var = (uint8_t *)(ROUNDUP((addr_t)__##var, CACHE_LINE))
+ uint8_t __##var[(size) + CACHE_LINE] __attribute__((aligned(CACHE_LINE))); uint8_t *var = (uint8_t *)(ROUNDUP((addr_t)__##var, CACHE_LINE))
/* Macro to allocate buffer in both local & global space, the STACKBUF_DMA_ALIGN cannot
* be used for global space.
diff --git a/platform/msm_shared/scm.c b/platform/msm_shared/scm.c
index ae381bc..be48b15 100644
--- a/platform/msm_shared/scm.c
+++ b/platform/msm_shared/scm.c
@@ -56,9 +56,16 @@
/* SCM interface as per ARM spec present? */
bool scm_arm_support;
+static bool scm_initialized;
bool is_scm_armv8_support()
{
+ if (!scm_initialized)
+ {
+ scm_init();
+ scm_initialized = true;
+ }
+
return scm_arm_support;
}
@@ -96,6 +103,9 @@
{
int ret;
+ if (scm_initialized)
+ return;
+
ret = scm_arm_support_available(SCM_SVC_INFO, IS_CALL_AVAIL_CMD);
if (ret < 0)
@@ -308,7 +318,7 @@
secure_cfg.spare = 0;
scmcall_arg scm_arg = {0};
- if(!scm_arm_support)
+ if(!is_scm_armv8_support())
{
ret = scm_call(SVC_MEMORY_PROTECTION, IOMMU_SECURE_CFG, &secure_cfg, sizeof(secure_cfg),
NULL, 0);
@@ -348,7 +358,7 @@
*/
arch_clean_invalidate_cache_range((addr_t) *img_ptr, *img_len_ptr);
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
ret = scm_call(SCM_SVC_SSD, SSD_ENCRYPT_ID, &cmd, sizeof(cmd), NULL, 0);
}
@@ -380,7 +390,7 @@
int ret;
img_req cmd;
- if (scm_arm_support)
+ if (is_scm_armv8_support())
{
dprintf(INFO, "%s:SCM call is not supported\n",__func__);
return -1;
@@ -431,7 +441,7 @@
do
{
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
ret = scm_call(SCM_SVC_SSD,
SSD_PARSE_MD_ID,
@@ -515,7 +525,7 @@
decrypt_req.frag_len = *img_len_ptr;
decrypt_req.frag = *img_ptr;
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
ret = scm_call(SCM_SVC_SSD,
SSD_DECRYPT_IMG_FRAG_ID,
@@ -581,7 +591,7 @@
feature_req.feature_id = TZBSP_FVER_SSD;
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
ret = scm_call(TZBSP_SVC_INFO,
TZ_INFO_GET_FEATURE_ID,
@@ -616,7 +626,7 @@
scmcall_arg scm_arg = {0};
scmcall_ret scm_ret = {0};
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
req.status_ptr = (uint32_t*)&rsp;
req.status_len = sizeof(rsp);
@@ -661,7 +671,7 @@
arch_clean_invalidate_cache_range((addr_t) img_ptr, img_len);
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
ret = scm_call(SCM_SVC_SSD,
SSD_PROTECT_KEYSTORE_ID,
@@ -710,7 +720,7 @@
cmd_buf = (void *)&fuse_id;
cmd_len = sizeof(fuse_id);
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
/*no response */
resp_buf = NULL;
@@ -750,7 +760,7 @@
cmd_buf = (void *)&fuse_id;
cmd_len = sizeof(fuse_id);
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
/*response */
resp_len = sizeof(resp_buf);
@@ -802,7 +812,7 @@
req.partition_id = 0; /* kernel */
memcpy(req.digest, digest, sizeof(req.digest));
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
svc_id = SCM_SVC_ES;
cmd_id = SCM_SAVE_PARTITION_HASH_ID;
@@ -846,7 +856,7 @@
req.out_buf_size = out_buf_size;
req.direction = direction;
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
svc_id = SCM_SVC_MDTP;
cmd_id = SCM_MDTP_CIPHER_DIP;
@@ -902,7 +912,7 @@
req.row_data = row_data;
req.qfprom_api_status = qfprom_api_status;
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
svc_id = SCM_SVC_FUSE;
cmd_id = SCM_QFPROM_READ_ROW_ID;
@@ -956,7 +966,7 @@
uint32_t chn_id;
}__PACKED switch_ce_chn_buf;
- if (scm_arm_support)
+ if (is_scm_armv8_support())
{
dprintf(INFO, "%s:SCM call is not supported\n",__func__);
return 0;
@@ -982,7 +992,7 @@
int ret = 0;
scmcall_arg scm_arg = {0};
- if (scm_arm_support) {
+ if (is_scm_armv8_support()) {
scm_arg.x0 = MAKE_SIP_SCM_CMD(SCM_SVC_PWR, SCM_IO_DISABLE_PMIC_ARBITER);
scm_arg.x1 = MAKE_SCM_ARGS(0x1);
scm_arg.x2 = 0;
@@ -994,7 +1004,7 @@
/* Retry with the SCM_IO_DISABLE_PMIC_ARBITER1 func ID if the above Func ID fails*/
if(ret) {
- if (scm_arm_support) {
+ if (is_scm_armv8_support()) {
scm_arg.x0 = MAKE_SIP_SCM_CMD(SCM_SVC_PWR, SCM_IO_DISABLE_PMIC_ARBITER1);
scm_arg.x1 = MAKE_SCM_ARGS(0x1);
scm_arg.x2 = 0;
@@ -1035,7 +1045,7 @@
/* Response Buffer = Null as no response expected */
dprintf(INFO, "Jumping to kernel via monitor\n");
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
/* Command Buffer */
cmd_buf = (void *)¶m;
@@ -1067,7 +1077,7 @@
// Memory passed to TZ should be algined to cache line
BUF_DMA_ALIGN(rand_buf, uint32_t);
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
data.out_buf = (uint8_t*) rand_buf;
data.out_buf_size = r_len;
@@ -1123,7 +1133,7 @@
scmcall_arg scm_arg = {0};
scmcall_ret scm_ret = {0};
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
cmd.config = ERR_FATAL_ENABLE;
cmd.spare = 0;
@@ -1234,7 +1244,7 @@
scmcall_arg scm_arg = {0};
scmcall_ret scm_ret = {0};
- if (!scm_arm_support) {
+ if (!is_scm_armv8_support()) {
ret = scm_call(TZBSP_SVC_INFO, IS_SECURE_BOOT_ENABLED, NULL, 0, &resp, sizeof(resp));
} else {
scm_arg.x0 = MAKE_SIP_SCM_CMD(TZBSP_SVC_INFO, IS_SECURE_BOOT_ENABLED);
@@ -1266,7 +1276,7 @@
scmcall_arg scm_arg = {0};
scmcall_ret scm_ret = {0};
- if (!scm_arm_support) {
+ if (!is_scm_armv8_support()) {
ret = scm_call_atomic(SCM_SVC_IO, SCM_IO_READ, address);
} else {
scm_arg.x0 = MAKE_SIP_SCM_CMD(SCM_SVC_IO, SCM_IO_READ);
@@ -1274,6 +1284,9 @@
scm_arg.x2 = address;
scm_arg.atomic = true;
ret = scm_call2(&scm_arg, &scm_ret);
+ /* Return the value read if the call is successful */
+ if (!ret)
+ ret = scm_ret.x1;
}
return ret;
}
@@ -1284,7 +1297,7 @@
scmcall_arg scm_arg = {0};
scmcall_ret scm_ret = {0};
- if (!scm_arm_support) {
+ if (!is_scm_armv8_support()) {
ret = scm_call_atomic2(SCM_SVC_IO, SCM_IO_WRITE, address, val);
} else {
scm_arg.x0 = MAKE_SIP_SCM_CMD(SCM_SVC_IO, SCM_IO_WRITE);
@@ -1303,7 +1316,7 @@
scmcall_arg scm_arg = {0};
scmcall_ret scm_ret = {0};
- if (!scm_arm_support)
+ if (!is_scm_armv8_support())
{
ret = scm_call_atomic2(svc, cmd, arg1, arg2);
} else {