Loading drivers/char/diag/diag_masks.c +2 −1 Original line number Diff line number Diff line Loading @@ -3201,7 +3201,8 @@ void diag_send_updates_peripheral(uint8_t peripheral) driver->real_time_mode[DIAG_LOCAL_PROC]); diag_send_peripheral_buffering_mode( &driver->buffering_mode[peripheral]); if (P_FMASK_DIAGID_V2(peripheral)) diag_send_hw_accel_status(peripheral); /* * Clear mask_update variable afer updating * logging masks to peripheral. Loading drivers/char/diag/diagchar.h +8 −1 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ #define DIAG_GET_TIME_API 0x21B #define DIAG_SET_TIME_API 0x21C #define DIAG_GET_DIAG_ID 0x222 #define DIAG_HW_ACCEL_CMD 0x224 #define DIAG_FEATURE_QUERY 0x225 #define DIAG_SWITCH_COMMAND 0x081B #define DIAG_BUFFERING_MODE 0x080C Loading Loading @@ -262,6 +263,9 @@ do { \ #define DIAGIDV2_STATUS(f_index) \ driver->diagid_v2_status[f_index] #define P_FMASK_DIAGID_V2(peripheral) \ driver->feature[peripheral].diagid_v2_feature_mask /* * Number of stm processors includes all the peripherals and * apps.Added 1 below to indicate apps Loading Loading @@ -891,6 +895,7 @@ struct diagchar_dev { uint8_t uses_time_api; uint32_t diagid_v2_feature[DIAGID_V2_FEATURE_COUNT]; uint32_t diagid_v2_status[DIAGID_V2_FEATURE_COUNT]; uint32_t diag_hw_accel[DIAGID_V2_FEATURE_COUNT]; }; extern struct diagchar_dev *driver; Loading Loading @@ -930,10 +935,12 @@ uint8_t diag_search_diagid_by_pd(uint8_t pd_val, void diag_record_stats(int type, int flag); struct diag_md_session_t *diag_md_session_get_pid(int pid); int diag_map_hw_accel_type_ver(uint8_t hw_accel_type, uint8_t hw_accel_ver); struct diag_md_session_t *diag_md_session_get_peripheral(int dev_id, uint8_t peripheral); int diag_md_session_match_pid_peripheral(int proc, int pid, uint8_t peripheral); int diag_map_hw_accel_type_ver(uint8_t hw_accel_type, uint8_t hw_accel_ver); void diag_map_index_to_hw_accel(uint8_t index, uint8_t *hw_accel_type, uint8_t *hw_accel_ver); #endif drivers/char/diag/diagchar_core.c +22 −3 Original line number Diff line number Diff line Loading @@ -2423,8 +2423,27 @@ static int diag_ioctl_query_pd_logging(struct diag_logging_mode_param_t *param) return ret; } int diag_map_hw_accel_type_ver( uint8_t hw_accel_type, uint8_t hw_accel_ver) void diag_map_index_to_hw_accel(uint8_t index, uint8_t *hw_accel_type, uint8_t *hw_accel_ver) { *hw_accel_type = 0; *hw_accel_ver = 0; switch (index) { case DIAG_HW_ACCEL_TYPE_STM: *hw_accel_type = DIAG_HW_ACCEL_TYPE_STM; *hw_accel_ver = DIAG_HW_ACCEL_VER_MIN; break; case DIAG_HW_ACCEL_TYPE_ATB: *hw_accel_type = DIAG_HW_ACCEL_TYPE_ATB; *hw_accel_ver = DIAG_HW_ACCEL_VER_MIN; break; default: break; } } int diag_map_hw_accel_type_ver(uint8_t hw_accel_type, uint8_t hw_accel_ver) { int index = -EINVAL; Loading Loading @@ -2483,7 +2502,7 @@ static int diag_ioctl_query_pd_featuremask( static int diag_ioctl_passthru_control_func( struct diag_hw_accel_cmd_req_t *req_params) { return diag_send_passtru_ctrl_pkt(req_params); return diag_send_passthru_ctrl_pkt(req_params); } static void diag_query_session_pid(struct diag_query_pid_t *param) Loading drivers/char/diag/diagfwd.c +1 −0 Original line number Diff line number Diff line Loading @@ -1043,6 +1043,7 @@ static void diag_init_apps_feature(void) driver->apps_feature = 0; SET_APPS_FEATURE(driver, F_DIAG_EVENT_REPORT); SET_APPS_FEATURE(driver, F_DIAG_HW_ACCELERATION); } void diag_send_error_rsp(unsigned char *buf, int len, Loading drivers/char/diag/diagfwd_cntl.c +70 −4 Original line number Diff line number Diff line Loading @@ -802,8 +802,8 @@ void process_diagid_v2_feature_mask(uint32_t diag_id, uint32_t pd_feature_mask) { int i = 0; uint32_t diagid_mask_bit = 0; uint32_t feature_id_mask = 0; uint32_t diagid_mask_bit = 0, feature_id_mask = 0; uint8_t hw_accel_type = 0, hw_accel_ver = 0; if (!pd_feature_mask) return; Loading @@ -814,6 +814,10 @@ void process_diagid_v2_feature_mask(uint32_t diag_id, if (feature_id_mask) driver->diagid_v2_feature[i] |= diagid_mask_bit; feature_id_mask = 0; diag_map_index_to_hw_accel(i, &hw_accel_type, &hw_accel_ver); if (hw_accel_type && hw_accel_ver) driver->diag_hw_accel[i] = 1; } mutex_unlock(&driver->diagid_v2_mutex); } Loading @@ -838,7 +842,7 @@ static void process_diagid(uint8_t *buf, uint32_t len, return; diagid_v2_feature_mask = driver->feature[peripheral].diagid_v2_feature_mask; P_FMASK_DIAGID_V2(peripheral); if (len < sizeof(struct diag_ctrl_diagid_header)) { pr_err("diag: Invalid control pkt len(%d) from peripheral: %d to parse packet header\n", Loading Loading @@ -1497,6 +1501,66 @@ int diag_send_peripheral_buffering_mode(struct diag_buffering_mode_t *params) return err; } void diag_send_hw_accel_status(uint8_t peripheral) { struct diag_hw_accel_cmd_req_t req_params; struct diagfwd_info *fwd_info = NULL; struct diag_id_info *diagid_struct = NULL; uint32_t diagid_mask_bit = 0; uint8_t hw_accel_type = 0, hw_accel_ver = 0; int feature = 0, pd = 0; DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "Send HW Acceleration Enabled status to peripheral: %d\n", peripheral); fwd_info = &peripheral_info[TYPE_CNTL][peripheral]; if (!fwd_info) { DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "Error return for peripheral: %d\n", peripheral); return; } for (feature = 0; feature < DIAGID_V2_FEATURE_COUNT - 1; feature++) { for (pd = 0; pd <= MAX_PERIPHERAL_UPD; pd++) { if (!pd) { diagid_struct = &fwd_info->root_diag_id; diagid_mask_bit = 1 << (diagid_struct->diagid_val - 1); } if (!diagid_mask_bit) continue; if (driver->diagid_v2_feature[feature] & driver->diagid_v2_status[feature] & diagid_mask_bit) { diag_map_index_to_hw_accel(feature, &hw_accel_type, &hw_accel_ver); req_params.header.cmd_code = DIAG_CMD_DIAG_SUBSYS; req_params.header.subsys_id = DIAG_SS_DIAG; req_params.header.subsys_cmd_code = DIAG_HW_ACCEL_CMD; req_params.version = 1; req_params.reserved = 0; req_params.operation = DIAG_HW_ACCEL_OP_ENABLE; req_params.op_req.hw_accel_type = hw_accel_type; req_params.op_req.hw_accel_ver = hw_accel_ver; req_params.op_req.diagid_mask = diagid_mask_bit; DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "Sending passthru packet for diag_id: %d\n", diagid_struct->diagid_val); if (P_FMASK_DIAGID_V2(peripheral)) diag_send_passthru_ctrl_pkt( &req_params); } diagid_struct = &fwd_info->upd_diag_id[pd]; diagid_mask_bit = 0; diagid_mask_bit = 1 << (diagid_struct->diagid_val - 1); } } } int diag_send_stm_state(uint8_t peripheral, uint8_t stm_control_data) { struct diag_ctrl_msg_stm stm_msg; Loading Loading @@ -1747,7 +1811,7 @@ int diag_send_buffering_wm_values(uint8_t peripheral, return err; } int diag_send_passtru_ctrl_pkt(struct diag_hw_accel_cmd_req_t *req_params) int diag_send_passthru_ctrl_pkt(struct diag_hw_accel_cmd_req_t *req_params) { struct diag_ctrl_passthru ctrl_pkt; int f_index = -1, err = 0; Loading Loading @@ -1805,6 +1869,8 @@ int diag_send_passtru_ctrl_pkt(struct diag_hw_accel_cmd_req_t *req_params) sizeof(ctrl_pkt.diagid_mask) + sizeof(ctrl_pkt.hw_accel_type) + sizeof(ctrl_pkt.hw_accel_ver) + sizeof(ctrl_pkt.control_data); for (i = 0; i < NUM_PERIPHERALS; i++) { if (!P_FMASK_DIAGID_V2(i)) continue; err = diagfwd_write(i, TYPE_CNTL, &ctrl_pkt, sizeof(ctrl_pkt)); if (err && err != -ENODEV) { pr_err("diag: Unable to send PASSTHRU ctrl packet to peripheral %d, err: %d\n", Loading Loading
drivers/char/diag/diag_masks.c +2 −1 Original line number Diff line number Diff line Loading @@ -3201,7 +3201,8 @@ void diag_send_updates_peripheral(uint8_t peripheral) driver->real_time_mode[DIAG_LOCAL_PROC]); diag_send_peripheral_buffering_mode( &driver->buffering_mode[peripheral]); if (P_FMASK_DIAGID_V2(peripheral)) diag_send_hw_accel_status(peripheral); /* * Clear mask_update variable afer updating * logging masks to peripheral. Loading
drivers/char/diag/diagchar.h +8 −1 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ #define DIAG_GET_TIME_API 0x21B #define DIAG_SET_TIME_API 0x21C #define DIAG_GET_DIAG_ID 0x222 #define DIAG_HW_ACCEL_CMD 0x224 #define DIAG_FEATURE_QUERY 0x225 #define DIAG_SWITCH_COMMAND 0x081B #define DIAG_BUFFERING_MODE 0x080C Loading Loading @@ -262,6 +263,9 @@ do { \ #define DIAGIDV2_STATUS(f_index) \ driver->diagid_v2_status[f_index] #define P_FMASK_DIAGID_V2(peripheral) \ driver->feature[peripheral].diagid_v2_feature_mask /* * Number of stm processors includes all the peripherals and * apps.Added 1 below to indicate apps Loading Loading @@ -891,6 +895,7 @@ struct diagchar_dev { uint8_t uses_time_api; uint32_t diagid_v2_feature[DIAGID_V2_FEATURE_COUNT]; uint32_t diagid_v2_status[DIAGID_V2_FEATURE_COUNT]; uint32_t diag_hw_accel[DIAGID_V2_FEATURE_COUNT]; }; extern struct diagchar_dev *driver; Loading Loading @@ -930,10 +935,12 @@ uint8_t diag_search_diagid_by_pd(uint8_t pd_val, void diag_record_stats(int type, int flag); struct diag_md_session_t *diag_md_session_get_pid(int pid); int diag_map_hw_accel_type_ver(uint8_t hw_accel_type, uint8_t hw_accel_ver); struct diag_md_session_t *diag_md_session_get_peripheral(int dev_id, uint8_t peripheral); int diag_md_session_match_pid_peripheral(int proc, int pid, uint8_t peripheral); int diag_map_hw_accel_type_ver(uint8_t hw_accel_type, uint8_t hw_accel_ver); void diag_map_index_to_hw_accel(uint8_t index, uint8_t *hw_accel_type, uint8_t *hw_accel_ver); #endif
drivers/char/diag/diagchar_core.c +22 −3 Original line number Diff line number Diff line Loading @@ -2423,8 +2423,27 @@ static int diag_ioctl_query_pd_logging(struct diag_logging_mode_param_t *param) return ret; } int diag_map_hw_accel_type_ver( uint8_t hw_accel_type, uint8_t hw_accel_ver) void diag_map_index_to_hw_accel(uint8_t index, uint8_t *hw_accel_type, uint8_t *hw_accel_ver) { *hw_accel_type = 0; *hw_accel_ver = 0; switch (index) { case DIAG_HW_ACCEL_TYPE_STM: *hw_accel_type = DIAG_HW_ACCEL_TYPE_STM; *hw_accel_ver = DIAG_HW_ACCEL_VER_MIN; break; case DIAG_HW_ACCEL_TYPE_ATB: *hw_accel_type = DIAG_HW_ACCEL_TYPE_ATB; *hw_accel_ver = DIAG_HW_ACCEL_VER_MIN; break; default: break; } } int diag_map_hw_accel_type_ver(uint8_t hw_accel_type, uint8_t hw_accel_ver) { int index = -EINVAL; Loading Loading @@ -2483,7 +2502,7 @@ static int diag_ioctl_query_pd_featuremask( static int diag_ioctl_passthru_control_func( struct diag_hw_accel_cmd_req_t *req_params) { return diag_send_passtru_ctrl_pkt(req_params); return diag_send_passthru_ctrl_pkt(req_params); } static void diag_query_session_pid(struct diag_query_pid_t *param) Loading
drivers/char/diag/diagfwd.c +1 −0 Original line number Diff line number Diff line Loading @@ -1043,6 +1043,7 @@ static void diag_init_apps_feature(void) driver->apps_feature = 0; SET_APPS_FEATURE(driver, F_DIAG_EVENT_REPORT); SET_APPS_FEATURE(driver, F_DIAG_HW_ACCELERATION); } void diag_send_error_rsp(unsigned char *buf, int len, Loading
drivers/char/diag/diagfwd_cntl.c +70 −4 Original line number Diff line number Diff line Loading @@ -802,8 +802,8 @@ void process_diagid_v2_feature_mask(uint32_t diag_id, uint32_t pd_feature_mask) { int i = 0; uint32_t diagid_mask_bit = 0; uint32_t feature_id_mask = 0; uint32_t diagid_mask_bit = 0, feature_id_mask = 0; uint8_t hw_accel_type = 0, hw_accel_ver = 0; if (!pd_feature_mask) return; Loading @@ -814,6 +814,10 @@ void process_diagid_v2_feature_mask(uint32_t diag_id, if (feature_id_mask) driver->diagid_v2_feature[i] |= diagid_mask_bit; feature_id_mask = 0; diag_map_index_to_hw_accel(i, &hw_accel_type, &hw_accel_ver); if (hw_accel_type && hw_accel_ver) driver->diag_hw_accel[i] = 1; } mutex_unlock(&driver->diagid_v2_mutex); } Loading @@ -838,7 +842,7 @@ static void process_diagid(uint8_t *buf, uint32_t len, return; diagid_v2_feature_mask = driver->feature[peripheral].diagid_v2_feature_mask; P_FMASK_DIAGID_V2(peripheral); if (len < sizeof(struct diag_ctrl_diagid_header)) { pr_err("diag: Invalid control pkt len(%d) from peripheral: %d to parse packet header\n", Loading Loading @@ -1497,6 +1501,66 @@ int diag_send_peripheral_buffering_mode(struct diag_buffering_mode_t *params) return err; } void diag_send_hw_accel_status(uint8_t peripheral) { struct diag_hw_accel_cmd_req_t req_params; struct diagfwd_info *fwd_info = NULL; struct diag_id_info *diagid_struct = NULL; uint32_t diagid_mask_bit = 0; uint8_t hw_accel_type = 0, hw_accel_ver = 0; int feature = 0, pd = 0; DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "Send HW Acceleration Enabled status to peripheral: %d\n", peripheral); fwd_info = &peripheral_info[TYPE_CNTL][peripheral]; if (!fwd_info) { DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "Error return for peripheral: %d\n", peripheral); return; } for (feature = 0; feature < DIAGID_V2_FEATURE_COUNT - 1; feature++) { for (pd = 0; pd <= MAX_PERIPHERAL_UPD; pd++) { if (!pd) { diagid_struct = &fwd_info->root_diag_id; diagid_mask_bit = 1 << (diagid_struct->diagid_val - 1); } if (!diagid_mask_bit) continue; if (driver->diagid_v2_feature[feature] & driver->diagid_v2_status[feature] & diagid_mask_bit) { diag_map_index_to_hw_accel(feature, &hw_accel_type, &hw_accel_ver); req_params.header.cmd_code = DIAG_CMD_DIAG_SUBSYS; req_params.header.subsys_id = DIAG_SS_DIAG; req_params.header.subsys_cmd_code = DIAG_HW_ACCEL_CMD; req_params.version = 1; req_params.reserved = 0; req_params.operation = DIAG_HW_ACCEL_OP_ENABLE; req_params.op_req.hw_accel_type = hw_accel_type; req_params.op_req.hw_accel_ver = hw_accel_ver; req_params.op_req.diagid_mask = diagid_mask_bit; DIAG_LOG(DIAG_DEBUG_PERIPHERALS, "Sending passthru packet for diag_id: %d\n", diagid_struct->diagid_val); if (P_FMASK_DIAGID_V2(peripheral)) diag_send_passthru_ctrl_pkt( &req_params); } diagid_struct = &fwd_info->upd_diag_id[pd]; diagid_mask_bit = 0; diagid_mask_bit = 1 << (diagid_struct->diagid_val - 1); } } } int diag_send_stm_state(uint8_t peripheral, uint8_t stm_control_data) { struct diag_ctrl_msg_stm stm_msg; Loading Loading @@ -1747,7 +1811,7 @@ int diag_send_buffering_wm_values(uint8_t peripheral, return err; } int diag_send_passtru_ctrl_pkt(struct diag_hw_accel_cmd_req_t *req_params) int diag_send_passthru_ctrl_pkt(struct diag_hw_accel_cmd_req_t *req_params) { struct diag_ctrl_passthru ctrl_pkt; int f_index = -1, err = 0; Loading Loading @@ -1805,6 +1869,8 @@ int diag_send_passtru_ctrl_pkt(struct diag_hw_accel_cmd_req_t *req_params) sizeof(ctrl_pkt.diagid_mask) + sizeof(ctrl_pkt.hw_accel_type) + sizeof(ctrl_pkt.hw_accel_ver) + sizeof(ctrl_pkt.control_data); for (i = 0; i < NUM_PERIPHERALS; i++) { if (!P_FMASK_DIAGID_V2(i)) continue; err = diagfwd_write(i, TYPE_CNTL, &ctrl_pkt, sizeof(ctrl_pkt)); if (err && err != -ENODEV) { pr_err("diag: Unable to send PASSTHRU ctrl packet to peripheral %d, err: %d\n", Loading