common: socinfo: Assign default host_id per device
authorLokesh Vutla <lokeshvutla@ti.com>
Sun, 22 Nov 2020 06:15:37 +0000 (11:45 +0530)
committerLokesh Vutla <lokeshvutla@ti.com>
Fri, 11 Dec 2020 12:35:14 +0000 (18:05 +0530)
Current implementation assumes that HOST_ID 14 is the default host_id
that is used for communicating with sysfw. HOST_ID 14 corresponds to 3rd
instance of non-secure Cortex-A context. It is not guaranteed that host
id 14 is available on all devices. So assign a per device default host
id.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
common/k3conf.c
common/socinfo.c
include/sec_proxy.h

index b40657d378e21cfc3801a526cb432b86f08127c6..283894e6e3fe5202a45525a56560e7b514a2f2f8 100644 (file)
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
                goto main_exit;
        }
 
-       host_id = DEFAULT_HOST_ID;
+       host_id = INVALID_HOST_ID;
        if (!strcmp(argv[0], "--host")) {
                argc--; argv++;
                ret = sscanf(argv[0], "%u", &host_id);
index 990bbc79b742069327ea738f20818ff0d5773b58..a69aef933d202f000ac69d62a3140c73de81a5a8 100644 (file)
@@ -112,6 +112,7 @@ static void am654_init(void)
        sci_info->num_clocks = AM65X_MAX_CLOCKS;
        sci_info->rm_info = am65x_rm_info;
        sci_info->num_res = AM65X_MAX_RES;
+       soc_info.host_id = DEFAULT_HOST_ID;
 }
 
 static void am654_sr2_init(void)
@@ -132,6 +133,7 @@ static void am654_sr2_init(void)
        sci_info->num_clocks = AM65X_SR2_MAX_CLOCKS;
        sci_info->rm_info = am65x_sr2_rm_info;
        sci_info->num_res = AM65X_SR2_MAX_RES;
+       soc_info.host_id = DEFAULT_HOST_ID;
 }
 
 static void j721e_init(void)
@@ -152,6 +154,7 @@ static void j721e_init(void)
        sci_info->num_clocks = J721E_MAX_CLOCKS;
        sci_info->rm_info = j721e_rm_info;
        sci_info->num_res = J721E_MAX_RES;
+       soc_info.host_id = DEFAULT_HOST_ID;
 }
 
 static void j7200_init(void)
@@ -172,6 +175,7 @@ static void j7200_init(void)
        sci_info->num_clocks = J7200_MAX_CLOCKS;
        sci_info->rm_info = j7200_rm_info;
        sci_info->num_res = J7200_MAX_RES;
+       soc_info.host_id = DEFAULT_HOST_ID;
 }
 
 int soc_init(uint32_t host_id)
@@ -211,8 +215,6 @@ int soc_init(uint32_t host_id)
        strcat(soc_info.soc_full_name, " SR");
        strcat(soc_info.soc_full_name, soc_revision[soc_info.rev]);
 
-       soc_info.host_id = host_id;
-
        if (soc_info.soc == AM65X && soc_info.rev == REV_SR1_0)
                am654_init();
        else if (soc_info.soc == AM65X && soc_info.rev == REV_SR2_0)
@@ -222,6 +224,9 @@ int soc_init(uint32_t host_id)
        else if (soc_info.soc == J7200)
                j7200_init();
 
+       if (host_id != INVALID_HOST_ID)
+               soc_info.host_id = host_id;
+
        /* ToDo: Add error if sec_proxy_init/sci_init is failed */
        if(!k3_sec_proxy_init())
                if (!ti_sci_init())
index bdc31d9e46856f0b17560173831f754cc3eaae7e..698405b02bf354590b3390597526b274b3a777f6 100644 (file)
@@ -40,6 +40,7 @@
 #define __SEC_PROXY_H
 
 #define DEFAULT_HOST_ID                14
+#define INVALID_HOST_ID                0xff
 #define DEFAULT_SEC_PROXY_RX_THREAD    21
 #define DEFAULT_SEC_PROXY_TX_THREAD    23