diff options
| author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-09-06 12:55:56 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-09-06 12:55:56 -0700 |
| commit | b864286bdb88dda9170c9d088bc9bee1eb0cfd34 (patch) | |
| tree | 72c6d29020177f73d0cb58a6df9c6bb5f571432b /drivers/char | |
| parent | b42a5cc33ba865e47328658f19ea5b081e333bfd (diff) | |
| parent | 930498cd7c5f52edbb69aa719083ddd9bde7bddd (diff) | |
Merge "diag: Proper Update of the PD packet buffer status and length"
Diffstat (limited to 'drivers/char')
| -rw-r--r-- | drivers/char/diag/diagfwd_peripheral.c | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/drivers/char/diag/diagfwd_peripheral.c b/drivers/char/diag/diagfwd_peripheral.c index c70115a8c4d7..0f94bab3bf84 100644 --- a/drivers/char/diag/diagfwd_peripheral.c +++ b/drivers/char/diag/diagfwd_peripheral.c @@ -500,15 +500,29 @@ static void diagfwd_data_read_untag_done(struct diagfwd_info *fwd_info, temp_buf_main += (buf_len + 4); processed += buf_len; } + + if (flag_buf_1) { + fwd_info->cpd_len_1 = len_cpd; + if (fwd_info->type == TYPE_DATA) + fwd_info->upd_len_1_a = len_upd_1; + if (peripheral == PERIPHERAL_LPASS && + fwd_info->type == TYPE_DATA) + fwd_info->upd_len_2_a = len_upd_2; + } else if (flag_buf_2) { + fwd_info->cpd_len_2 = len_cpd; + if (fwd_info->type == TYPE_DATA) + fwd_info->upd_len_1_b = len_upd_1; + if (peripheral == PERIPHERAL_LPASS && + fwd_info->type == TYPE_DATA) + fwd_info->upd_len_2_b = len_upd_2; + } + if (peripheral == PERIPHERAL_LPASS && fwd_info->type == TYPE_DATA && len_upd_2) { - if (flag_buf_1) { - fwd_info->upd_len_2_a = len_upd_2; + if (flag_buf_1) temp_ptr_upd = fwd_info->buf_upd_2_a; - } else { - fwd_info->upd_len_2_b = len_upd_2; + else temp_ptr_upd = fwd_info->buf_upd_2_b; - } temp_ptr_upd->ctxt &= 0x00FFFFFF; temp_ptr_upd->ctxt |= (SET_PD_CTXT(ctxt_upd_2)); @@ -522,15 +536,10 @@ static void diagfwd_data_read_untag_done(struct diagfwd_info *fwd_info, fwd_info->upd_len_2_b = 0; } if (fwd_info->type == TYPE_DATA && len_upd_1) { - if (flag_buf_1) { - fwd_info->upd_len_1_a = - len_upd_1; + if (flag_buf_1) temp_ptr_upd = fwd_info->buf_upd_1_a; - } else { - fwd_info->upd_len_1_b = - len_upd_1; + else temp_ptr_upd = fwd_info->buf_upd_1_b; - } temp_ptr_upd->ctxt &= 0x00FFFFFF; temp_ptr_upd->ctxt |= (SET_PD_CTXT(ctxt_upd_1)); @@ -544,10 +553,6 @@ static void diagfwd_data_read_untag_done(struct diagfwd_info *fwd_info, fwd_info->upd_len_1_b = 0; } if (len_cpd) { - if (flag_buf_1) - fwd_info->cpd_len_1 = len_cpd; - else - fwd_info->cpd_len_2 = len_cpd; temp_ptr_cpd->ctxt &= 0x00FFFFFF; temp_ptr_cpd->ctxt |= (SET_PD_CTXT(ctxt_cpd)); @@ -1332,12 +1337,33 @@ void diagfwd_write_done(uint8_t peripheral, uint8_t type, int ctxt) if (ctxt == 1 && fwd_info->buf_1) { /* Buffer 1 for core PD is freed */ - atomic_set(&fwd_info->buf_1->in_busy, 0); fwd_info->cpd_len_1 = 0; + + if (peripheral == PERIPHERAL_LPASS) { + if (!fwd_info->upd_len_1_a && + !fwd_info->upd_len_2_a) + atomic_set(&fwd_info->buf_1->in_busy, 0); + } else if (peripheral == PERIPHERAL_MODEM) { + if (!fwd_info->upd_len_1_a) + atomic_set(&fwd_info->buf_1->in_busy, 0); + } else { + atomic_set(&fwd_info->buf_1->in_busy, 0); + } } else if (ctxt == 2 && fwd_info->buf_2) { /* Buffer 2 for core PD is freed */ - atomic_set(&fwd_info->buf_2->in_busy, 0); fwd_info->cpd_len_2 = 0; + + if (peripheral == PERIPHERAL_LPASS) { + if (!fwd_info->upd_len_1_b && + !fwd_info->upd_len_2_b) + atomic_set(&fwd_info->buf_2->in_busy, 0); + } else if (peripheral == PERIPHERAL_MODEM) { + if (!fwd_info->upd_len_1_b) + atomic_set(&fwd_info->buf_2->in_busy, 0); + } else { + atomic_set(&fwd_info->buf_2->in_busy, 0); + } + } else if (ctxt == 3 && fwd_info->buf_upd_1_a) { /* Buffer 1 for user pd 1 is freed */ atomic_set(&fwd_info->buf_upd_1_a->in_busy, 0); |
