qcacmn: Add support to populate and send UMAC reset setup command

UMAC reset prerequisite setup command contains the following information.
- Interrupt number to be used for raising the UMAC reset interrupt
- Address of the shared memory
This is an HTT command. Send this command as part of the UMAC reset
initialization sequence.

Change-Id: I7a08f48b420580b5e3dbb9b46f6605d986f8fd89
CRs-Fixed: 3244930
This commit is contained in:
Shiva Krishna Pittala
2022-07-15 15:37:51 +05:30
committed by Madan Koyyalamudi
parent 12964fb1de
commit 68c2b67520
3 changed files with 164 additions and 1 deletions

View File

@@ -4951,3 +4951,107 @@ fail:
qdf_disable_work(&pdev->bkp_stats.work);
return QDF_STATUS_E_FAILURE;
}
#ifdef DP_UMAC_HW_RESET_SUPPORT
QDF_STATUS dp_htt_umac_reset_send_setup_cmd(
struct dp_soc *soc,
const struct dp_htt_umac_reset_setup_cmd_params *setup_params)
{
struct htt_soc *htt_handle = soc->htt_handle;
uint32_t len;
qdf_nbuf_t msg;
u_int32_t *msg_word;
QDF_STATUS status;
uint8_t *htt_logger_bufp;
struct dp_htt_htc_pkt *pkt;
len = HTT_MSG_BUF_SIZE(
HTT_H2T_UMAC_HANG_RECOVERY_PREREQUISITE_SETUP_BYTES);
msg = qdf_nbuf_alloc(soc->osdev,
len,
/* reserve room for the HTC header */
HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING,
4,
TRUE);
if (!msg)
return QDF_STATUS_E_NOMEM;
/*
* Set the length of the message.
* The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
* separately during the below call to qdf_nbuf_push_head.
* The contribution from the HTC header is added separately inside HTC.
*/
if (!qdf_nbuf_put_tail(
msg, HTT_H2T_UMAC_HANG_RECOVERY_PREREQUISITE_SETUP_BYTES)) {
dp_htt_err("Failed to expand head");
qdf_nbuf_free(msg);
return QDF_STATUS_E_FAILURE;
}
/* fill in the message contents */
msg_word = (uint32_t *)qdf_nbuf_data(msg);
/* Rewind beyond alignment pad to get to the HTC header reserved area */
qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
htt_logger_bufp = (uint8_t *)msg_word;
qdf_mem_zero(msg_word,
HTT_H2T_UMAC_HANG_RECOVERY_PREREQUISITE_SETUP_BYTES);
HTT_H2T_MSG_TYPE_SET(
*msg_word,
HTT_H2T_MSG_TYPE_UMAC_HANG_RECOVERY_PREREQUISITE_SETUP);
HTT_H2T_UMAC_HANG_RECOVERY_PREREQUISITE_SETUP_T2H_MSG_METHOD_SET(
*msg_word, htt_umac_hang_recovery_msg_t2h_msi_and_h2t_polling);
HTT_H2T_UMAC_HANG_RECOVERY_PREREQUISITE_SETUP_H2T_MSG_METHOD_SET(
*msg_word, htt_umac_hang_recovery_msg_t2h_msi_and_h2t_polling);
msg_word++;
*msg_word = setup_params->msi_data;
msg_word++;
*msg_word = sizeof(htt_umac_hang_recovery_msg_shmem_t);
msg_word++;
*msg_word = setup_params->shmem_addr_low;
msg_word++;
*msg_word = setup_params->shmem_addr_high;
pkt = htt_htc_pkt_alloc(htt_handle);
if (!pkt) {
qdf_err("Fail to allocate dp_htt_htc_pkt buffer");
qdf_assert(0);
qdf_nbuf_free(msg);
return QDF_STATUS_E_NOMEM;
}
pkt->soc_ctxt = NULL; /* not used during send-done callback */
SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
dp_htt_h2t_send_complete_free_netbuf,
qdf_nbuf_data(msg),
qdf_nbuf_len(msg),
htt_handle->htc_endpoint,
/* tag for no FW response msg */
HTC_TX_PACKET_TAG_RUNTIME_PUT);
SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
status = DP_HTT_SEND_HTC_PKT(
htt_handle, pkt,
HTT_H2T_MSG_TYPE_UMAC_HANG_RECOVERY_PREREQUISITE_SETUP,
htt_logger_bufp);
if (QDF_IS_STATUS_ERROR(status)) {
qdf_nbuf_free(msg);
htt_htc_pkt_free(htt_handle, pkt);
return status;
}
dp_info("HTT_H2T_MSG_TYPE_UMAC_HANG_RECOVERY_PREREQUISITE_SETUP sent");
return status;
}
#endif