mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2026-01-27 12:35:36 +01:00
LF-14029-1: drivers: firmware: imx: new api v2x debug dump
New API support is added for dumping v2x debug logs. Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com> Reviewed-by: Rahul Kumar Yadav <rahulkumar.yadav@nxp.com> Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com> Acked-by: Jason Liu <jason.hui.liu@nxp.com>
This commit is contained in:
parent
d97abaf3e7
commit
9d86c4874b
|
|
@ -167,7 +167,7 @@ static bool exception_for_size(struct se_if_priv *priv,
|
|||
/* List of API(s) that can be accepte variable length
|
||||
* response buffer.
|
||||
*/
|
||||
if (header->command == ELE_DEBUG_DUMP_REQ &&
|
||||
if ((header->command == ELE_DEBUG_DUMP_REQ || header->command == V2X_DEBUG_DUMP_REQ) &&
|
||||
header->ver == priv->if_defs->base_api_ver &&
|
||||
header->size >= 0 &&
|
||||
header->size <= ELE_DEBUG_DUMP_RSP_SZ)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
#include "ele_common.h"
|
||||
#include "v2x_base_msg.h"
|
||||
|
||||
#define FW_DBG_DUMP_FIXED_STR "\nS40X: "
|
||||
|
||||
/*
|
||||
* v2x_start_rng() - prepare and send the command to start
|
||||
* initialization of the ELE RNG context
|
||||
|
|
@ -145,3 +147,68 @@ int v2x_pwr_state(struct se_if_priv *priv, u16 action)
|
|||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int v2x_debug_dump(struct se_if_priv *priv)
|
||||
{
|
||||
struct se_api_msg *tx_msg __free(kfree) = NULL;
|
||||
struct se_api_msg *rx_msg __free(kfree) = NULL;
|
||||
bool keep_logging;
|
||||
int msg_ex_cnt;
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (!priv)
|
||||
return -EINVAL;
|
||||
|
||||
tx_msg = kzalloc(V2X_DEBUG_DUMP_REQ_SZ, GFP_KERNEL);
|
||||
if (!tx_msg)
|
||||
return -ENOMEM;
|
||||
|
||||
rx_msg = kzalloc(V2X_DEBUG_DUMP_RSP_SZ, GFP_KERNEL);
|
||||
if (!rx_msg)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = se_fill_cmd_msg_hdr(priv,
|
||||
&tx_msg->header,
|
||||
V2X_DEBUG_DUMP_REQ,
|
||||
V2X_DEBUG_DUMP_REQ_SZ,
|
||||
true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
tx_msg->header.tag = V2X_DEBUG_MU_MSG_CMD_TAG;
|
||||
tx_msg->header.ver = V2X_DEBUG_MU_MSG_VERS;
|
||||
tx_msg->data[0] = 0x1;
|
||||
msg_ex_cnt = 0;
|
||||
do {
|
||||
memset(rx_msg, 0x0, V2X_DEBUG_DUMP_RSP_SZ);
|
||||
|
||||
ret = ele_msg_send_rcv(priv->priv_dev_ctx, tx_msg, V2X_DEBUG_DUMP_REQ_SZ,
|
||||
rx_msg, V2X_DEBUG_DUMP_RSP_SZ);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = se_val_rsp_hdr_n_status(priv, rx_msg, V2X_DEBUG_DUMP_REQ,
|
||||
V2X_DEBUG_DUMP_RSP_SZ, true);
|
||||
if (ret) {
|
||||
dev_err(priv->dev, "Dump_Debug_Buffer Error: %x.", ret);
|
||||
break;
|
||||
}
|
||||
keep_logging = (rx_msg->header.size >= (V2X_DEBUG_DUMP_RSP_SZ >> 2) &&
|
||||
msg_ex_cnt < V2X_MAX_DBG_DMP_PKT);
|
||||
|
||||
rx_msg->header.size -= 2;
|
||||
|
||||
if (rx_msg->header.size > 4)
|
||||
rx_msg->header.size--;
|
||||
|
||||
for (i = 0; i < rx_msg->header.size; i += 2)
|
||||
dev_info(priv->dev, "%s%02x_%02x: 0x%08x 0x%08x",
|
||||
FW_DBG_DUMP_FIXED_STR, msg_ex_cnt, i,
|
||||
rx_msg->data[i + 1], rx_msg->data[i + 2]);
|
||||
|
||||
msg_ex_cnt++;
|
||||
} while (keep_logging);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,17 @@
|
|||
#define V2X_PERM_DENIED_FAIL_IND 0xF329
|
||||
#define V2X_INVAL_OPS_FAIL_IND 0xC029
|
||||
|
||||
#define V2X_DEBUG_MU_MSG_VERS 0x02
|
||||
#define V2X_DEBUG_MU_MSG_CMD_TAG 0x17
|
||||
#define V2X_DEBUG_MU_MSG_RSP_TAG 0xE1
|
||||
|
||||
#define V2X_MAX_DBG_DMP_PKT 15
|
||||
#define V2X_NON_DUMP_BUFFER_SZ 3
|
||||
#define V2X_DEBUG_DUMP_REQ 0x02
|
||||
#define V2X_DEBUG_DUMP_REQ_SZ 0x08
|
||||
#define V2X_DEBUG_DUMP_RSP_SZ 0x5c
|
||||
|
||||
int v2x_start_rng(struct se_if_priv *priv);
|
||||
int v2x_pwr_state(struct se_if_priv *priv, u16 action);
|
||||
int v2x_debug_dump(struct se_if_priv *priv);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user