Loading drivers/char/diag/diag_debugfs.c +6 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,9 @@ static ssize_t diag_dbgfs_read_status(struct file *file, char __user *ubuf, "RIVA CNTL in_buf_1_size: %d\n" "Modem DCI in_buf_1_size: %d\n" "Modem DCI CMD in_buf_1_size: %d\n" "Received Feature mask from Modem: %d\n" "Received Feature mask from LPASS: %d\n" "Received Feature mask from WCNSS: %d\n" "logging_mode: %d\n" "real_time_mode: %d\n", (unsigned int)driver->smd_data[MODEM_DATA].ch, Loading Loading @@ -171,6 +174,9 @@ static ssize_t diag_dbgfs_read_status(struct file *file, char __user *ubuf, (unsigned int)driver->smd_cntl[WCNSS_DATA].buf_in_1_size, (unsigned int)driver->smd_dci[MODEM_DATA].buf_in_1_size, (unsigned int)driver->smd_dci_cmd[MODEM_DATA].buf_in_1_size, driver->rcvd_feature_mask[MODEM_DATA], driver->rcvd_feature_mask[LPASS_DATA], driver->rcvd_feature_mask[WCNSS_DATA], driver->logging_mode, driver->real_time_mode); Loading drivers/char/diag/diagchar.h +1 −0 Original line number Diff line number Diff line Loading @@ -347,6 +347,7 @@ struct diagchar_dev { struct diag_smd_info smd_dci[NUM_SMD_DCI_CHANNELS]; struct diag_smd_info smd_cmd[NUM_SMD_CMD_CHANNELS]; struct diag_smd_info smd_dci_cmd[NUM_SMD_DCI_CMD_CHANNELS]; int rcvd_feature_mask[NUM_SMD_CONTROL_CHANNELS]; int separate_cmdrsp[NUM_SMD_CONTROL_CHANNELS]; unsigned char *usb_buf_out; unsigned char *apps_rsp_buf; Loading drivers/char/diag/diagfwd.c +26 −12 Original line number Diff line number Diff line Loading @@ -207,11 +207,12 @@ int chk_polling_response(void) * has registered to respond for polling */ return 1; else if (!(driver->smd_data[MODEM_DATA].ch) && !(chk_apps_master())) else if (!((driver->smd_data[MODEM_DATA].ch) && (driver->rcvd_feature_mask[MODEM_DATA])) && (chk_apps_master())) /* * If the apps processor is not the master and the modem * is not up * is not up or we did not receive the feature masks from Modem */ return 1; else Loading Loading @@ -1186,6 +1187,18 @@ int diag_process_stm_cmd(unsigned char *buf) return 0; } int diag_apps_responds() { if (chk_apps_only()) { if (driver->smd_data[MODEM_DATA].ch && driver->rcvd_feature_mask[MODEM_DATA]) { return 0; } return 1; } return 0; } int diag_process_apps_pkt(unsigned char *buf, int len) { uint16_t subsys_cmd_code; Loading Loading @@ -1220,7 +1233,8 @@ int diag_process_apps_pkt(unsigned char *buf, int len) pr_debug("diag: %d %d %d", cmd_code, subsys_id, subsys_cmd_code); for (i = 0; i < diag_max_reg; i++) { entry = driver->table[i]; if (entry.process_id != NO_PROCESS) { if (entry.process_id != NO_PROCESS && driver->rcvd_feature_mask[entry.client_id]) { if (entry.cmd_code == cmd_code && entry.subsys_id == subsys_id && entry.cmd_code_lo <= subsys_cmd_code && Loading Loading @@ -1266,8 +1280,7 @@ int diag_process_apps_pkt(unsigned char *buf, int len) return diag_process_stm_cmd(buf); } /* Check for Apps Only & get event mask request */ else if (!(driver->smd_data[MODEM_DATA].ch) && chk_apps_only() && *buf == 0x81) { else if (diag_apps_responds() && *buf == 0x81) { driver->apps_rsp_buf[0] = 0x81; driver->apps_rsp_buf[1] = 0x0; *(uint16_t *)(driver->apps_rsp_buf + 2) = 0x0; Loading @@ -1278,8 +1291,8 @@ int diag_process_apps_pkt(unsigned char *buf, int len) return 0; } /* Get log ID range & Check for Apps Only */ else if (!(driver->smd_data[MODEM_DATA].ch) && chk_apps_only() && (*buf == 0x73) && *(int *)(buf+4) == 1) { else if (diag_apps_responds() && (*buf == 0x73) && *(int *)(buf+4) == 1) { driver->apps_rsp_buf[0] = 0x73; *(int *)(driver->apps_rsp_buf + 4) = 0x1; /* operation ID */ *(int *)(driver->apps_rsp_buf + 8) = 0x0; /* success code */ Loading @@ -1303,8 +1316,8 @@ int diag_process_apps_pkt(unsigned char *buf, int len) return 0; } /* Respond to Get SSID Range request message */ else if (!(driver->smd_data[MODEM_DATA].ch) && chk_apps_only() && (*buf == 0x7d) && (*(buf+1) == 0x1)) { else if (diag_apps_responds() && (*buf == 0x7d) && (*(buf+1) == 0x1)) { driver->apps_rsp_buf[0] = 0x7d; driver->apps_rsp_buf[1] = 0x1; driver->apps_rsp_buf[2] = 0x1; Loading Loading @@ -1361,8 +1374,8 @@ int diag_process_apps_pkt(unsigned char *buf, int len) return 0; } /* Check for Apps Only Respond to Get Subsys Build mask */ else if (!(driver->smd_data[MODEM_DATA].ch) && chk_apps_only() && (*buf == 0x7d) && (*(buf+1) == 0x2)) { else if (diag_apps_responds() && (*buf == 0x7d) && (*(buf+1) == 0x2)) { ssid_first = *(uint16_t *)(buf + 2); ssid_last = *(uint16_t *)(buf + 4); ssid_range = 4 * (ssid_last - ssid_first + 1); Loading Loading @@ -2460,6 +2473,7 @@ void diagfwd_init(void) for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++) { driver->separate_cmdrsp[i] = 0; driver->peripheral_supports_stm[i] = DISABLE_STM; driver->rcvd_feature_mask[i] = 0; } for (i = 0; i < NUM_STM_PROCESSORS; i++) { Loading drivers/char/diag/diagfwd.h +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ void diag_cmp_logging_modes_sdio_pipe(int old_mode, int new_mode); void diag_cmp_logging_modes_diagfwd_bridge(int old_mode, int new_mode); int diag_process_apps_pkt(unsigned char *buf, int len); void diag_reset_smd_data(int queue); int diag_apps_responds(void); /* State for diag forwarding */ #ifdef CONFIG_DIAG_OVER_USB int diagfwd_connect(void); Loading drivers/char/diag/diagfwd_cntl.c +17 −5 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ void diag_clean_reg_fn(struct work_struct *work) diag_clear_reg(smd_info->peripheral); reg_dirty ^= smd_info->peripheral_mask; /* Reset the feature mask flag */ driver->rcvd_feature_mask[smd_info->peripheral] = 0; smd_info->notify_context = 0; } Loading Loading @@ -158,14 +161,21 @@ int diag_process_smd_cntl_read_data(struct diag_smd_info *smd_info, void *buf, msg = buf+HDR_SIZ; range = buf+HDR_SIZ+ sizeof(struct diag_ctrl_msg); if (msg->count_entries == 0) { pr_debug("diag: In %s, received reg tbl with no entries\n", __func__); buf = buf + HDR_SIZ + data_len; continue; } pkt_params->count = msg->count_entries; pkt_params->params = kzalloc(pkt_params->count * sizeof(struct bindpkt_params), GFP_KERNEL); if (ZERO_OR_NULL_PTR(pkt_params->params)) { pr_alert("diag: In %s, Memory alloc fail\n", __func__); kfree(pkt_params); return flag; if (!pkt_params->params) { pr_alert("diag: In %s, Memory alloc fail for cmd_code: %d, subsys: %d\n", __func__, msg->cmd_code, msg->subsysid); buf = buf + HDR_SIZ + data_len; continue; } temp = pkt_params->params; for (j = 0; j < pkt_params->count; j++) { Loading Loading @@ -195,6 +205,8 @@ int diag_process_smd_cntl_read_data(struct diag_smd_info *smd_info, void *buf, int feature_mask_len = *(int *)(buf+8); if (feature_mask_len > 0) { int periph = smd_info->peripheral; driver->rcvd_feature_mask[smd_info->peripheral] = 1; feature_mask = *(uint8_t *)(buf+12); if (periph == MODEM_DATA) driver->log_on_demand_support = Loading Loading
drivers/char/diag/diag_debugfs.c +6 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,9 @@ static ssize_t diag_dbgfs_read_status(struct file *file, char __user *ubuf, "RIVA CNTL in_buf_1_size: %d\n" "Modem DCI in_buf_1_size: %d\n" "Modem DCI CMD in_buf_1_size: %d\n" "Received Feature mask from Modem: %d\n" "Received Feature mask from LPASS: %d\n" "Received Feature mask from WCNSS: %d\n" "logging_mode: %d\n" "real_time_mode: %d\n", (unsigned int)driver->smd_data[MODEM_DATA].ch, Loading Loading @@ -171,6 +174,9 @@ static ssize_t diag_dbgfs_read_status(struct file *file, char __user *ubuf, (unsigned int)driver->smd_cntl[WCNSS_DATA].buf_in_1_size, (unsigned int)driver->smd_dci[MODEM_DATA].buf_in_1_size, (unsigned int)driver->smd_dci_cmd[MODEM_DATA].buf_in_1_size, driver->rcvd_feature_mask[MODEM_DATA], driver->rcvd_feature_mask[LPASS_DATA], driver->rcvd_feature_mask[WCNSS_DATA], driver->logging_mode, driver->real_time_mode); Loading
drivers/char/diag/diagchar.h +1 −0 Original line number Diff line number Diff line Loading @@ -347,6 +347,7 @@ struct diagchar_dev { struct diag_smd_info smd_dci[NUM_SMD_DCI_CHANNELS]; struct diag_smd_info smd_cmd[NUM_SMD_CMD_CHANNELS]; struct diag_smd_info smd_dci_cmd[NUM_SMD_DCI_CMD_CHANNELS]; int rcvd_feature_mask[NUM_SMD_CONTROL_CHANNELS]; int separate_cmdrsp[NUM_SMD_CONTROL_CHANNELS]; unsigned char *usb_buf_out; unsigned char *apps_rsp_buf; Loading
drivers/char/diag/diagfwd.c +26 −12 Original line number Diff line number Diff line Loading @@ -207,11 +207,12 @@ int chk_polling_response(void) * has registered to respond for polling */ return 1; else if (!(driver->smd_data[MODEM_DATA].ch) && !(chk_apps_master())) else if (!((driver->smd_data[MODEM_DATA].ch) && (driver->rcvd_feature_mask[MODEM_DATA])) && (chk_apps_master())) /* * If the apps processor is not the master and the modem * is not up * is not up or we did not receive the feature masks from Modem */ return 1; else Loading Loading @@ -1186,6 +1187,18 @@ int diag_process_stm_cmd(unsigned char *buf) return 0; } int diag_apps_responds() { if (chk_apps_only()) { if (driver->smd_data[MODEM_DATA].ch && driver->rcvd_feature_mask[MODEM_DATA]) { return 0; } return 1; } return 0; } int diag_process_apps_pkt(unsigned char *buf, int len) { uint16_t subsys_cmd_code; Loading Loading @@ -1220,7 +1233,8 @@ int diag_process_apps_pkt(unsigned char *buf, int len) pr_debug("diag: %d %d %d", cmd_code, subsys_id, subsys_cmd_code); for (i = 0; i < diag_max_reg; i++) { entry = driver->table[i]; if (entry.process_id != NO_PROCESS) { if (entry.process_id != NO_PROCESS && driver->rcvd_feature_mask[entry.client_id]) { if (entry.cmd_code == cmd_code && entry.subsys_id == subsys_id && entry.cmd_code_lo <= subsys_cmd_code && Loading Loading @@ -1266,8 +1280,7 @@ int diag_process_apps_pkt(unsigned char *buf, int len) return diag_process_stm_cmd(buf); } /* Check for Apps Only & get event mask request */ else if (!(driver->smd_data[MODEM_DATA].ch) && chk_apps_only() && *buf == 0x81) { else if (diag_apps_responds() && *buf == 0x81) { driver->apps_rsp_buf[0] = 0x81; driver->apps_rsp_buf[1] = 0x0; *(uint16_t *)(driver->apps_rsp_buf + 2) = 0x0; Loading @@ -1278,8 +1291,8 @@ int diag_process_apps_pkt(unsigned char *buf, int len) return 0; } /* Get log ID range & Check for Apps Only */ else if (!(driver->smd_data[MODEM_DATA].ch) && chk_apps_only() && (*buf == 0x73) && *(int *)(buf+4) == 1) { else if (diag_apps_responds() && (*buf == 0x73) && *(int *)(buf+4) == 1) { driver->apps_rsp_buf[0] = 0x73; *(int *)(driver->apps_rsp_buf + 4) = 0x1; /* operation ID */ *(int *)(driver->apps_rsp_buf + 8) = 0x0; /* success code */ Loading @@ -1303,8 +1316,8 @@ int diag_process_apps_pkt(unsigned char *buf, int len) return 0; } /* Respond to Get SSID Range request message */ else if (!(driver->smd_data[MODEM_DATA].ch) && chk_apps_only() && (*buf == 0x7d) && (*(buf+1) == 0x1)) { else if (diag_apps_responds() && (*buf == 0x7d) && (*(buf+1) == 0x1)) { driver->apps_rsp_buf[0] = 0x7d; driver->apps_rsp_buf[1] = 0x1; driver->apps_rsp_buf[2] = 0x1; Loading Loading @@ -1361,8 +1374,8 @@ int diag_process_apps_pkt(unsigned char *buf, int len) return 0; } /* Check for Apps Only Respond to Get Subsys Build mask */ else if (!(driver->smd_data[MODEM_DATA].ch) && chk_apps_only() && (*buf == 0x7d) && (*(buf+1) == 0x2)) { else if (diag_apps_responds() && (*buf == 0x7d) && (*(buf+1) == 0x2)) { ssid_first = *(uint16_t *)(buf + 2); ssid_last = *(uint16_t *)(buf + 4); ssid_range = 4 * (ssid_last - ssid_first + 1); Loading Loading @@ -2460,6 +2473,7 @@ void diagfwd_init(void) for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++) { driver->separate_cmdrsp[i] = 0; driver->peripheral_supports_stm[i] = DISABLE_STM; driver->rcvd_feature_mask[i] = 0; } for (i = 0; i < NUM_STM_PROCESSORS; i++) { Loading
drivers/char/diag/diagfwd.h +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ void diag_cmp_logging_modes_sdio_pipe(int old_mode, int new_mode); void diag_cmp_logging_modes_diagfwd_bridge(int old_mode, int new_mode); int diag_process_apps_pkt(unsigned char *buf, int len); void diag_reset_smd_data(int queue); int diag_apps_responds(void); /* State for diag forwarding */ #ifdef CONFIG_DIAG_OVER_USB int diagfwd_connect(void); Loading
drivers/char/diag/diagfwd_cntl.c +17 −5 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ void diag_clean_reg_fn(struct work_struct *work) diag_clear_reg(smd_info->peripheral); reg_dirty ^= smd_info->peripheral_mask; /* Reset the feature mask flag */ driver->rcvd_feature_mask[smd_info->peripheral] = 0; smd_info->notify_context = 0; } Loading Loading @@ -158,14 +161,21 @@ int diag_process_smd_cntl_read_data(struct diag_smd_info *smd_info, void *buf, msg = buf+HDR_SIZ; range = buf+HDR_SIZ+ sizeof(struct diag_ctrl_msg); if (msg->count_entries == 0) { pr_debug("diag: In %s, received reg tbl with no entries\n", __func__); buf = buf + HDR_SIZ + data_len; continue; } pkt_params->count = msg->count_entries; pkt_params->params = kzalloc(pkt_params->count * sizeof(struct bindpkt_params), GFP_KERNEL); if (ZERO_OR_NULL_PTR(pkt_params->params)) { pr_alert("diag: In %s, Memory alloc fail\n", __func__); kfree(pkt_params); return flag; if (!pkt_params->params) { pr_alert("diag: In %s, Memory alloc fail for cmd_code: %d, subsys: %d\n", __func__, msg->cmd_code, msg->subsysid); buf = buf + HDR_SIZ + data_len; continue; } temp = pkt_params->params; for (j = 0; j < pkt_params->count; j++) { Loading Loading @@ -195,6 +205,8 @@ int diag_process_smd_cntl_read_data(struct diag_smd_info *smd_info, void *buf, int feature_mask_len = *(int *)(buf+8); if (feature_mask_len > 0) { int periph = smd_info->peripheral; driver->rcvd_feature_mask[smd_info->peripheral] = 1; feature_mask = *(uint8_t *)(buf+12); if (periph == MODEM_DATA) driver->log_on_demand_support = Loading