25 #include <linux/types.h>
43 #define MAX_INT2CHAR_LENGTH 16
46 #define DEPLIBSECT ".dspbridge_deplibs"
62 static s32 atoi(
char *psz_buf);
63 static int get_attrs_from_buf(
char *psz_buf,
u32 ul_buf_size,
66 static void compress_buf(
char *psz_buf,
u32 ul_buf_size,
s32 char_size);
67 static char dsp_char2_gpp_char(
char *
word,
s32 dsp_char_size);
68 static int get_dep_lib_info(
struct dcd_manager *hdcd_mgr,
73 bool *prstnt_dep_libs,
89 (
void *)sz_coff_path);
128 status =
cod_create(&cod_mgr, sz_zl_dll_name);
134 if (dcd_mgr_obj !=
NULL) {
139 *dcd_mgr = dcd_mgr_obj;
194 if ((index != 0) && (enum_refs == 0)) {
229 strncat(sz_reg_key, sz_obj_type,
238 spin_lock(&dbdcd_lock);
247 spin_unlock(&dbdcd_lock);
249 if (&dcd_key->
link == ®_key_list)
258 *uuid_obj = dsp_uuid_obj;
264 }
else if (status == -
ENODATA) {
307 bool *prstnt_dep_libs,
313 get_dep_lib_info(hdcd_mgr, uuid_obj, &num_libs,
NULL, dep_lib_uuids,
314 prstnt_dep_libs, phase);
324 u16 *num_libs,
u16 *num_pers_libs,
329 status = get_dep_lib_info(hdcd_mgr, uuid_obj, num_libs, num_pers_libs,
393 strncat(sz_reg_key, sz_obj_type,
411 spin_lock(&dbdcd_lock);
417 spin_unlock(&dbdcd_lock);
418 if (&dcd_key->
link == ®_key_list) {
435 if (len + 1 >
sizeof(sz_sect_name)) {
454 }
while (len &&
strncat(sz_sect_name,
"_", 2));
464 psz_coff_buf = kzalloc(ul_len + 4,
GFP_KERNEL);
465 if (psz_coff_buf ==
NULL) {
477 dev_dbg(
bridge,
"%s: Skipped Byte swap for IVA!!\n", __func__);
487 compress_buf(psz_coff_buf, ul_len, 1);
489 "for IVA!!\n", __func__);
494 get_attrs_from_buf(psz_coff_buf, ul_len, obj_type, obj_def);
545 if (status || !(ul_len > 0)) {
551 psz_coff_buf = kzalloc(ul_len + 4,
GFP_KERNEL);
552 if (psz_coff_buf ==
NULL) {
560 psz_coff_buf, ul_len);
562 dev_dbg(
bridge,
"%s: Skipped Byte swap for IVA!!\n", __func__);
564 psz_coff_buf, ul_len);
575 compress_buf(psz_coff_buf, ul_len, 1);
577 "for IVA!!\n", __func__);
581 psz_cur = psz_coff_buf;
582 while ((token =
strsep(&psz_cur, seps)) && *token !=
'\0') {
587 token =
strsep(&psz_cur, seps);
590 object_type = atoi(token);
601 register_fxn(&dsp_uuid_obj, object_type, handle);
640 dev_dbg(
bridge,
"%s: hdcd_mgr %p, uuid_obj %p, str_lib_name %p,"
641 " buff_size %p\n", __func__, hdcd_mgr, uuid_obj, str_lib_name,
680 strncat(sz_reg_key, sz_obj_type,
693 spin_lock(&dbdcd_lock);
700 spin_unlock(&dbdcd_lock);
703 if (&dcd_key->
link == ®_key_list)
709 *phase_split =
false;
721 strncat(sz_reg_key, sz_obj_type,
732 spin_lock(&dbdcd_lock);
739 spin_unlock(&dbdcd_lock);
741 status = (&dcd_key->
link != ®_key_list) ?
760 INIT_LIST_HEAD(®_key_list);
781 u32 dw_path_size = 0;
786 dev_dbg(
bridge,
"%s: object UUID %p, obj_type %d, szPathName %s\n",
787 __func__, uuid_obj, obj_type, psz_path_name);
811 strncat(sz_reg_key, sz_obj_type,
833 dw_path_size =
strlen(psz_path_name) + 1;
834 spin_lock(&dbdcd_lock);
841 spin_unlock(&dbdcd_lock);
842 if (&dcd_key->
link == ®_key_list) {
858 if (!dcd_key->
path) {
868 spin_lock(&dbdcd_lock);
870 spin_unlock(&dbdcd_lock);
886 memcpy(dcd_key->
path, psz_path_name, dw_path_size);
889 __func__, psz_path_name, dw_path_size);
892 spin_lock(&dbdcd_lock);
895 strlen(sz_reg_key) + 1)) {
902 spin_unlock(&dbdcd_lock);
903 if (&dcd_key->
link == ®_key_list)
951 static s32 atoi(
char *psz_buf)
959 if (*pch ==
'-' || *pch ==
'+') {
976 static int get_attrs_from_buf(
char *psz_buf,
u32 ul_buf_size,
997 token =
strsep(&psz_cur, seps);
1002 token =
strsep(&psz_cur, seps);
1008 token =
strsep(&psz_cur, seps);
1011 token_len =
strlen(token);
1018 token =
strsep(&psz_cur, seps);
1021 token =
strsep(&psz_cur, seps);
1024 token =
strsep(&psz_cur, seps);
1027 cb_struct = (
u32) atoi(token);
1028 token =
strsep(&psz_cur, seps);
1031 dsp_resource_reqmts.static_data_size = atoi(token);
1032 token =
strsep(&psz_cur, seps);
1034 dsp_resource_reqmts.global_data_size = atoi(token);
1035 token =
strsep(&psz_cur, seps);
1037 dsp_resource_reqmts.program_mem_size = atoi(token);
1038 token =
strsep(&psz_cur, seps);
1040 dsp_resource_reqmts.wc_execution_time = atoi(token);
1041 token =
strsep(&psz_cur, seps);
1043 dsp_resource_reqmts.wc_period = atoi(token);
1044 token =
strsep(&psz_cur, seps);
1047 dsp_resource_reqmts.wc_deadline = atoi(token);
1048 token =
strsep(&psz_cur, seps);
1051 dsp_resource_reqmts.avg_exection_time = atoi(token);
1052 token =
strsep(&psz_cur, seps);
1055 dsp_resource_reqmts.minimum_period = atoi(token);
1056 token =
strsep(&psz_cur, seps);
1060 token =
strsep(&psz_cur, seps);
1064 token =
strsep(&psz_cur, seps);
1069 token =
strsep(&psz_cur, seps);
1073 token =
strsep(&psz_cur, seps);
1078 token =
strsep(&psz_cur, seps);
1083 token =
strsep(&psz_cur, seps);
1088 token =
strsep(&psz_cur, seps);
1092 token =
strsep(&psz_cur, seps);
1095 token_len =
strlen(token);
1102 token =
strsep(&psz_cur, seps);
1105 token_len =
strlen(token);
1112 token =
strsep(&psz_cur, seps);
1115 token_len =
strlen(token);
1122 token =
strsep(&psz_cur, seps);
1126 token =
strsep(&psz_cur, seps);
1130 token =
strsep(&psz_cur, seps);
1134 token_len =
strlen(token);
1141 token =
strsep(&psz_cur, seps);
1147 token =
strsep(&psz_cur, seps);
1154 token =
strsep(&psz_cur, seps);
1161 token =
strsep(&psz_cur, seps);
1172 ndb_props.count_profiles; i++) {
1173 token =
strsep(&psz_cur, seps);
1177 ndb_props.node_profiles[
i].
1178 heap_size = atoi(token);
1182 token =
strsep(&psz_cur, seps);
1196 token =
strsep(&psz_cur, seps);
1199 token =
strsep(&psz_cur, seps);
1202 token =
strsep(&psz_cur, seps);
1205 token =
strsep(&psz_cur, seps);
1208 token =
strsep(&psz_cur, seps);
1211 token =
strsep(&psz_cur, seps);
1214 token =
strsep(&psz_cur, seps);
1217 token =
strsep(&psz_cur, seps);
1220 token =
strsep(&psz_cur, seps);
1223 token =
strsep(&psz_cur, seps);
1230 for (entry_id = 0; entry_id < 7; entry_id++) {
1231 token =
strsep(&psz_cur, seps);
1233 gpp_phys = atoi(token);
1235 token =
strsep(&psz_cur, seps);
1237 dsp_virt = atoi(token);
1256 static void compress_buf(
char *psz_buf,
u32 ul_buf_size,
s32 char_size)
1266 for (q = psz_buf; q < (psz_buf + ul_buf_size);) {
1267 ch = dsp_char2_gpp_char(q, char_size);
1270 ch = dsp_char2_gpp_char(q, char_size);
1309 static char dsp_char2_gpp_char(
char *
word,
s32 dsp_char_size)
1315 for (ch_src = word, i = dsp_char_size; i > 0; i--)
1324 static int get_dep_lib_info(
struct dcd_manager *hdcd_mgr,
1329 bool *prstnt_dep_libs,
1333 char *psz_coff_buf =
NULL;
1335 char *psz_file_name =
NULL;
1342 bool get_uuids = (dep_lib_uuids !=
NULL);
1354 psz_file_name = kzalloc(dw_data_size,
GFP_KERNEL);
1355 if (psz_file_name ==
NULL) {
1360 &dw_data_size, phase,
NULL);
1379 if (status || !(ul_len > 0))
1383 psz_coff_buf = kzalloc(ul_len + 4,
GFP_KERNEL);
1384 if (psz_coff_buf ==
NULL)
1396 psz_cur = psz_coff_buf;
1397 while ((token =
strsep(&psz_cur, seps)) && *token !=
'\0') {
1399 if (dep_libs >= *num_libs) {
1408 token =
strsep(&psz_cur, seps);
1409 prstnt_dep_libs[dep_libs] = atoi(token);
1414 token =
strsep(&psz_cur, seps);
1427 kfree(psz_file_name);
1429 kfree(psz_coff_buf);