diff options
author | Ye Li | 2022-04-06 14:30:20 +0800 |
---|---|---|
committer | Stefano Babic | 2022-04-12 17:33:57 +0200 |
commit | 203412f66dd24ef96927068aef37123f97e482cf (patch) | |
tree | 9ab294cb3339ad9eab651af442775480155dd4d5 /drivers/misc/imx8ulp | |
parent | a55ca506c969518e06eb8434f741eea2f5bfbe3e (diff) |
misc: S400_API: Update S400 API for buffer dump
Add ahab_dump_buffer API to dump AHAB buffer for debug purpose
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'drivers/misc/imx8ulp')
-rw-r--r-- | drivers/misc/imx8ulp/s400_api.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/misc/imx8ulp/s400_api.c b/drivers/misc/imx8ulp/s400_api.c index dd5f9f25da5..3ffdeb2ad2a 100644 --- a/drivers/misc/imx8ulp/s400_api.c +++ b/drivers/misc/imx8ulp/s400_api.c @@ -271,3 +271,37 @@ int ahab_release_caam(u32 core_did, u32 *response) return ret; } + +int ahab_dump_buffer(u32 *buffer, u32 buffer_length) +{ + struct udevice *dev = gd->arch.s400_dev; + int size = sizeof(struct imx8ulp_s400_msg); + struct imx8ulp_s400_msg msg; + int ret, i = 0; + + if (!dev) { + printf("s400 dev is not initialized\n"); + return -ENODEV; + } + + msg.version = AHAB_VERSION; + msg.tag = AHAB_CMD_TAG; + msg.size = 1; + msg.command = AHAB_LOG_CID; + + ret = misc_call(dev, false, &msg, size, &msg, size); + if (ret) { + printf("Error: %s: ret %d, response 0x%x\n", + __func__, ret, msg.data[0]); + + return ret; + } + + if (buffer) { + buffer[i++] = *(u32 *)&msg; /* Need dump the response header */ + for (; i < buffer_length && i < msg.size; i++) + buffer[i] = msg.data[i - 1]; + } + + return i; +} |