diag: Enable masks for user pd memory device session
Currently, masks are not getting enabled on peripherals when launching user pd memory device session. The patch takes care to enable the masks properly. CRs-Fixed: 2051486 Change-Id: I8aa38310f5ec20a41aa0a0e123033d6c8cb38d48 Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
This commit is contained in:
parent
60be71604a
commit
7687d76d92
4 changed files with 88 additions and 20 deletions
|
@ -28,7 +28,8 @@
|
|||
#define DIAG_SET_FEATURE_MASK(x) (feature_bytes[(x)/8] |= (1 << (x & 0x7)))
|
||||
|
||||
#define diag_check_update(x) \
|
||||
(!info || (info && (info->peripheral_mask & MD_PERIPHERAL_MASK(x)))) \
|
||||
(!info || (info && (info->peripheral_mask & MD_PERIPHERAL_MASK(x))) \
|
||||
|| (info && (info->peripheral_mask & MD_PERIPHERAL_PD_MASK(x)))) \
|
||||
|
||||
struct diag_mask_info msg_mask;
|
||||
struct diag_mask_info msg_bt_mask;
|
||||
|
@ -89,7 +90,7 @@ static void diag_send_log_mask_update(uint8_t peripheral, int equip_id)
|
|||
int err = 0;
|
||||
int send_once = 0;
|
||||
int header_len = sizeof(struct diag_ctrl_log_mask);
|
||||
uint8_t *buf = NULL;
|
||||
uint8_t *buf = NULL, upd = 0;
|
||||
uint8_t *temp = NULL;
|
||||
uint32_t mask_size = 0;
|
||||
struct diag_ctrl_log_mask ctrl_pkt;
|
||||
|
@ -106,11 +107,25 @@ static void diag_send_log_mask_update(uint8_t peripheral, int equip_id)
|
|||
return;
|
||||
}
|
||||
|
||||
if (driver->md_session_mask != 0 &&
|
||||
driver->md_session_mask & MD_PERIPHERAL_MASK(peripheral))
|
||||
mask_info = driver->md_session_map[peripheral]->log_mask;
|
||||
else
|
||||
if (driver->md_session_mask != 0) {
|
||||
if (driver->md_session_mask & MD_PERIPHERAL_MASK(peripheral)) {
|
||||
if (driver->md_session_map[peripheral])
|
||||
mask_info =
|
||||
driver->md_session_map[peripheral]->log_mask;
|
||||
} else if (driver->md_session_mask &
|
||||
MD_PERIPHERAL_PD_MASK(peripheral)) {
|
||||
upd = diag_mask_to_pd_value(driver->md_session_mask);
|
||||
if (upd && driver->md_session_map[upd])
|
||||
mask_info =
|
||||
driver->md_session_map[upd]->log_mask;
|
||||
} else {
|
||||
DIAG_LOG(DIAG_DEBUG_MASKS,
|
||||
"asking for mask update with unknown session mask\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
mask_info = &log_mask;
|
||||
}
|
||||
|
||||
if (!mask_info || !mask_info->ptr || !mask_info->update_buf)
|
||||
return;
|
||||
|
@ -195,7 +210,7 @@ static void diag_send_log_mask_update(uint8_t peripheral, int equip_id)
|
|||
|
||||
static void diag_send_event_mask_update(uint8_t peripheral)
|
||||
{
|
||||
uint8_t *buf = NULL;
|
||||
uint8_t *buf = NULL, upd = 0;
|
||||
uint8_t *temp = NULL;
|
||||
struct diag_ctrl_event_mask header;
|
||||
struct diag_mask_info *mask_info = NULL;
|
||||
|
@ -220,11 +235,25 @@ static void diag_send_event_mask_update(uint8_t peripheral)
|
|||
return;
|
||||
}
|
||||
|
||||
if (driver->md_session_mask != 0 &&
|
||||
(driver->md_session_mask & MD_PERIPHERAL_MASK(peripheral)))
|
||||
mask_info = driver->md_session_map[peripheral]->event_mask;
|
||||
else
|
||||
if (driver->md_session_mask != 0) {
|
||||
if (driver->md_session_mask & MD_PERIPHERAL_MASK(peripheral)) {
|
||||
if (driver->md_session_map[peripheral])
|
||||
mask_info =
|
||||
driver->md_session_map[peripheral]->event_mask;
|
||||
} else if (driver->md_session_mask &
|
||||
MD_PERIPHERAL_PD_MASK(peripheral)) {
|
||||
upd = diag_mask_to_pd_value(driver->md_session_mask);
|
||||
if (upd && driver->md_session_map[upd])
|
||||
mask_info =
|
||||
driver->md_session_map[upd]->event_mask;
|
||||
} else {
|
||||
DIAG_LOG(DIAG_DEBUG_MASKS,
|
||||
"asking for mask update with unknown session mask\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
mask_info = &event_mask;
|
||||
}
|
||||
|
||||
if (!mask_info || !mask_info->ptr || !mask_info->update_buf)
|
||||
return;
|
||||
|
@ -284,7 +313,7 @@ static void diag_send_msg_mask_update(uint8_t peripheral, int first, int last)
|
|||
int err = 0;
|
||||
int header_len = sizeof(struct diag_ctrl_msg_mask);
|
||||
int temp_len = 0;
|
||||
uint8_t *buf = NULL;
|
||||
uint8_t *buf = NULL, upd = 0;
|
||||
uint8_t *temp = NULL;
|
||||
uint32_t mask_size = 0;
|
||||
struct diag_mask_info *mask_info = NULL;
|
||||
|
@ -301,11 +330,25 @@ static void diag_send_msg_mask_update(uint8_t peripheral, int first, int last)
|
|||
return;
|
||||
}
|
||||
|
||||
if (driver->md_session_mask != 0 &&
|
||||
(driver->md_session_mask & MD_PERIPHERAL_MASK(peripheral)))
|
||||
mask_info = driver->md_session_map[peripheral]->msg_mask;
|
||||
else
|
||||
if (driver->md_session_mask != 0) {
|
||||
if (driver->md_session_mask & MD_PERIPHERAL_MASK(peripheral)) {
|
||||
if (driver->md_session_map[peripheral])
|
||||
mask_info =
|
||||
driver->md_session_map[peripheral]->msg_mask;
|
||||
} else if (driver->md_session_mask &
|
||||
MD_PERIPHERAL_PD_MASK(peripheral)) {
|
||||
upd = diag_mask_to_pd_value(driver->md_session_mask);
|
||||
if (upd && driver->md_session_map[upd])
|
||||
mask_info =
|
||||
driver->md_session_map[upd]->msg_mask;
|
||||
} else {
|
||||
DIAG_LOG(DIAG_DEBUG_MASKS,
|
||||
"asking for mask update with unknown session mask\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
mask_info = &msg_mask;
|
||||
}
|
||||
|
||||
if (!mask_info || !mask_info->ptr || !mask_info->update_buf)
|
||||
return;
|
||||
|
|
|
@ -360,10 +360,6 @@ drop_data:
|
|||
err = copy_to_user(buf + sizeof(int),
|
||||
(void *)&num_data,
|
||||
sizeof(int));
|
||||
} else {
|
||||
DIAG_LOG(DIAG_DEBUG_PERIPHERALS,
|
||||
"diag: md_session_map[%d] with pid = %d Exited..\n",
|
||||
peripheral, driver->md_session_map[peripheral]->pid);
|
||||
}
|
||||
diag_ws_on_copy_complete(DIAG_WS_MUX);
|
||||
if (drain_again)
|
||||
|
|
|
@ -235,6 +235,10 @@
|
|||
|
||||
#define MD_PERIPHERAL_MASK(x) (1 << x)
|
||||
|
||||
#define MD_PERIPHERAL_PD_MASK(x) \
|
||||
((x == PERIPHERAL_MODEM) ? (1 << UPD_WLAN) : \
|
||||
((x == PERIPHERAL_LPASS) ? (1 << UPD_AUDIO | 1 << UPD_SENSORS) : 0))\
|
||||
|
||||
/*
|
||||
* Number of stm processors includes all the peripherals and
|
||||
* apps.Added 1 below to indicate apps
|
||||
|
@ -673,6 +677,7 @@ void diag_cmd_remove_reg_by_proc(int proc);
|
|||
int diag_cmd_chk_polling(struct diag_cmd_reg_entry_t *entry);
|
||||
int diag_mask_param(void);
|
||||
void diag_clear_masks(struct diag_md_session_t *info);
|
||||
uint8_t diag_mask_to_pd_value(uint32_t peripheral_mask);
|
||||
|
||||
void diag_record_stats(int type, int flag);
|
||||
|
||||
|
|
|
@ -403,6 +403,30 @@ static uint32_t diag_translate_kernel_to_user_mask(uint32_t peripheral_mask)
|
|||
ret |= DIAG_CON_UPD_SENSORS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint8_t diag_mask_to_pd_value(uint32_t peripheral_mask)
|
||||
{
|
||||
uint8_t upd = 0;
|
||||
uint32_t pd_mask = 0;
|
||||
|
||||
pd_mask = diag_translate_kernel_to_user_mask(peripheral_mask);
|
||||
switch (pd_mask) {
|
||||
case DIAG_CON_UPD_WLAN:
|
||||
upd = UPD_WLAN;
|
||||
break;
|
||||
case DIAG_CON_UPD_AUDIO:
|
||||
upd = UPD_AUDIO;
|
||||
break;
|
||||
case DIAG_CON_UPD_SENSORS:
|
||||
upd = UPD_SENSORS;
|
||||
break;
|
||||
default:
|
||||
DIAG_LOG(DIAG_DEBUG_MASKS,
|
||||
"asking for mask update with no pd mask set\n");
|
||||
}
|
||||
return upd;
|
||||
}
|
||||
|
||||
int diag_mask_param(void)
|
||||
{
|
||||
return diag_mask_clear_param;
|
||||
|
|
Loading…
Add table
Reference in a new issue