aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch128
-rw-r--r--recipes-support/fastrpc/fastrpc_git.bb1
2 files changed, 129 insertions, 0 deletions
diff --git a/recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch b/recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch
new file mode 100644
index 0000000..1206c6e
--- /dev/null
+++ b/recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch
@@ -0,0 +1,128 @@
+From 771c3bc695a18b3bdedea6fac44b3e71708cc540 Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Date: Sat, 6 Mar 2021 04:25:01 +0300
+Subject: [PATCH] apps_std_fopen_with_env: account for domain kinds when
+ looking for data
+
+Currenty apps_std_fopen_with_env() will care about domain only in the
+fallback path when looking into /dsp/ dir (/dsp/adsp, /dsp/cdsp, etc).
+Account for different domains when looking for the file in the path (so
+that e.g. cDSP files will be looked up in the /usr/lib/rfsa/cdsp
+directory rather than the default /usr/lib/rfsa/adsp).
+
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Change-Id: I1dac61d36edc9e8ff1fdc2d56f968d2578f10399
+---
+ src/apps_std_imp.c | 60 ++++++++++++++++++++++------------------------
+ 1 file changed, 28 insertions(+), 32 deletions(-)
+
+diff --git a/src/apps_std_imp.c b/src/apps_std_imp.c
+index d2559c60d2d6..701d799f5608 100644
+--- a/src/apps_std_imp.c
++++ b/src/apps_std_imp.c
+@@ -662,6 +662,7 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna
+ char *absName = NULL;
+ uint16 absNameLen = 0;
+ int domain;
++ const char *dspName = NULL;
+
+ VERIFYC(NULL != mode, AEE_EINVALIDMODE);
+ VERIFYC(NULL != delim, AEE_EINVALIDFORMAT);
+@@ -670,8 +671,23 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna
+ VERIFY(0 == (nErr = get_dirlist_from_env(envvarname, &dirListBuf )));
+ VERIFYC(NULL != (dirList = dirListBuf), AEE_EMEMPTR);
+
++ domain = get_domain_id() & DOMAIN_ID_MASK;
++
++ if (domain == ADSP_DOMAIN_ID){
++ dspName = "adsp";
++ } else if (domain == MDSP_DOMAIN_ID){
++ dspName = "mdsp";
++ } else if (domain == SDSP_DOMAIN_ID){
++ dspName = "sdsp";
++ } else if (domain == CDSP_DOMAIN_ID) {
++ dspName = "cdsp";
++ } else {
++ dspName = "adsp";
++ }
++
+ while(dirList)
+ {
++ int dirNameLen;
+ pos = strstr(dirList, delim);
+ dirName = dirList;
+ if (pos) {
+@@ -682,10 +698,13 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna
+ }
+
+ // Account for slash char
+- absNameLen = std_strlen(dirName) + std_strlen(name) + 2;
++ dirNameLen = std_strlen(dirName);
++ absNameLen = dirNameLen + std_strlen(name) + 2;
+ VERIFYC(NULL != (absName = (char*)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY);
+ if ('\0' != *dirName) {
+ std_strlcpy(absName, dirName, absNameLen);
++ if (!std_strcmp(absName + dirNameLen - 4, "adsp"))
++ std_memscpy(absName + dirNameLen - 4, 4, dspName, 4);
+ std_strlcat(absName, "/", absNameLen);
+ std_strlcat(absName, name, absNameLen);
+ } else {
+@@ -699,47 +718,24 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna
+ goto bail;
+ }
+ }
+- domain = get_domain_id() & DOMAIN_ID_MASK;
+
+ #ifdef ANDROID_P
+ absNameLen = std_strlen("/vendor/dsp/adsp/") + std_strlen(name) + 1;
+ VERIFYC(NULL != (absName = (char*)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY);
+
+- if (domain == ADSP_DOMAIN_ID){
+- std_strlcpy(absName, "/vendor/dsp/adsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == MDSP_DOMAIN_ID){
+- std_strlcpy(absName, "/vendor/dsp/mdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == SDSP_DOMAIN_ID){
+- std_strlcpy(absName, "/vendor/dsp/sdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == CDSP_DOMAIN_ID) {
+- std_strlcpy(absName, "/vendor/dsp/cdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else {
+- absName[0] = '\0';
+- }
++ std_strlcpy(absName, "/vendor/dsp/", absNameLen);
++ std_strlcat(absName, dspName, absNameLen);
++ std_strlcat(absName, "/", absNameLen);
++ std_strlcat(absName, name,absNameLen);
+ nErr = apps_std_fopen(absName, mode, psout);
+ #else
+ absNameLen = std_strlen("/dsp/adsp/") + std_strlen(name) + 1;
+ VERIFYC(NULL != (absName = (char*)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY);
+
+- if (domain == ADSP_DOMAIN_ID){
+- std_strlcpy(absName, "/dsp/adsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == MDSP_DOMAIN_ID){
+- std_strlcpy(absName, "/dsp/mdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == SDSP_DOMAIN_ID){
+- std_strlcpy(absName, "/dsp/sdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else if (domain == CDSP_DOMAIN_ID) {
+- std_strlcpy(absName, "/dsp/cdsp/", absNameLen);
+- std_strlcat(absName, name,absNameLen);
+- } else {
+- absName[0] = '\0';
+- }
++ std_strlcpy(absName, "/dsp/", absNameLen);
++ std_strlcat(absName, dspName, absNameLen);
++ std_strlcat(absName, "/", absNameLen);
++ std_strlcat(absName, name,absNameLen);
+ nErr = apps_std_fopen(absName, mode, psout);
+ #endif
+ bail:
+--
+2.30.0
+
diff --git a/recipes-support/fastrpc/fastrpc_git.bb b/recipes-support/fastrpc/fastrpc_git.bb
index 2cc343e..179d42b 100644
--- a/recipes-support/fastrpc/fastrpc_git.bb
+++ b/recipes-support/fastrpc/fastrpc_git.bb
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://src/fastrpc_apps_user.c;beginline=1;endline=29;md5=f9
SRCREV = "bc36c705c9b057ca880a423021d3c19f02edeadd"
SRC_URI = "\
git://git.linaro.org/landing-teams/working/qualcomm/fastrpc.git;branch=automake;protocol=https \
+ file://0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch \
file://adsprpcd.service \
file://cdsprpcd.service \
file://usr-lib-rfsa.service \