misc: S400_API: New API for FW status and chip info

Add new API to get sentinel FW status and SoC chip info

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
Peng Fan 2022-07-26 16:40:52 +08:00 committed by Stefano Babic
parent e5fcf91348
commit 625473d6ce
2 changed files with 74 additions and 0 deletions

View file

@ -19,8 +19,10 @@
#define AHAB_READ_FUSE_REQ_CID 0x97
#define AHAB_GET_FW_VERSION_CID 0x9D
#define AHAB_RELEASE_RDC_REQ_CID 0xC4
#define AHAB_GET_FW_STATUS_CID 0xC5
#define AHAB_WRITE_FUSE_REQ_CID 0xD6
#define AHAB_CAAM_RELEASE_CID 0xD7
#define AHAB_GET_INFO_CID 0xDA
#define S400_MAX_MSG 255U
@ -32,6 +34,15 @@ struct imx8ulp_s400_msg {
u32 data[(S400_MAX_MSG - 1U)];
};
struct sentinel_get_info_data {
u32 hdr;
u32 soc;
u32 lc;
u32 uid[4];
u32 sha256_rom_patch[8];
u32 sha_fw[8];
};
int ahab_release_rdc(u8 core_id, u8 xrdc, u32 *response);
int ahab_auth_oem_ctnr(ulong ctnr_addr, u32 *response);
int ahab_release_container(u32 *response);
@ -42,5 +53,7 @@ int ahab_read_common_fuse(u16 fuse_id, u32 *fuse_words, u32 fuse_num, u32 *respo
int ahab_release_caam(u32 core_did, u32 *response);
int ahab_get_fw_version(u32 *fw_version, u32 *sha1, u32 *response);
int ahab_dump_buffer(u32 *buffer, u32 buffer_length);
int ahab_get_info(struct sentinel_get_info_data *info, u32 *response);
int ahab_get_fw_status(u32 *status, u32 *response);
#endif

View file

@ -359,3 +359,64 @@ int ahab_dump_buffer(u32 *buffer, u32 buffer_length)
return i;
}
int ahab_get_info(struct sentinel_get_info_data *info, u32 *response)
{
struct udevice *dev = gd->arch.s400_dev;
int size = sizeof(struct imx8ulp_s400_msg);
struct imx8ulp_s400_msg msg;
int ret;
if (!dev) {
printf("s400 dev is not initialized\n");
return -ENODEV;
}
msg.version = AHAB_VERSION;
msg.tag = AHAB_CMD_TAG;
msg.size = 4;
msg.command = AHAB_GET_INFO_CID;
msg.data[0] = upper_32_bits((ulong)info);
msg.data[1] = lower_32_bits((ulong)info);
msg.data[2] = sizeof(struct sentinel_get_info_data);
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]);
if (response)
*response = msg.data[0];
return ret;
}
int ahab_get_fw_status(u32 *status, u32 *response)
{
struct udevice *dev = gd->arch.s400_dev;
int size = sizeof(struct imx8ulp_s400_msg);
struct imx8ulp_s400_msg msg;
int ret;
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_GET_FW_STATUS_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]);
if (response)
*response = msg.data[0];
*status = msg.data[1] & 0xF;
return ret;
}