mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 23:47:24 +00:00
misc: sentinel: s400_api: Add get_events API
Add get_events API to retrieve any singular events that has occurred since the FW has started from sentinel Signed-off-by: Ye Li <ye.li@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
4dfb2196cd
commit
76c184fe3a
2 changed files with 47 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
#define AHAB_FWD_LIFECYCLE_UP_REQ_CID 0x95
|
||||
#define AHAB_READ_FUSE_REQ_CID 0x97
|
||||
#define AHAB_GET_FW_VERSION_CID 0x9D
|
||||
#define AHAB_GET_EVENTS_REQ_CID 0xA2
|
||||
#define AHAB_RELEASE_RDC_REQ_CID 0xC4
|
||||
#define AHAB_GET_FW_STATUS_CID 0xC5
|
||||
#define AHAB_WRITE_FUSE_REQ_CID 0xD6
|
||||
|
@ -58,5 +59,6 @@ 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);
|
||||
int ahab_release_m33_trout(void);
|
||||
int ahab_get_events(u32 *events, u32 *events_cnt, u32 *response);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -445,3 +445,48 @@ int ahab_release_m33_trout(void)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ahab_get_events(u32 *events, u32 *events_cnt, u32 *response)
|
||||
{
|
||||
struct udevice *dev = gd->arch.s400_dev;
|
||||
int size = sizeof(struct sentinel_msg);
|
||||
struct sentinel_msg msg;
|
||||
int ret, i = 0;
|
||||
u32 actual_events;
|
||||
|
||||
if (!dev) {
|
||||
printf("s400 dev is not initialized\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (!events || !events_cnt || *events_cnt == 0) {
|
||||
printf("Invalid parameters for %s\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
msg.version = AHAB_VERSION;
|
||||
msg.tag = AHAB_CMD_TAG;
|
||||
msg.size = 1;
|
||||
msg.command = AHAB_GET_EVENTS_REQ_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];
|
||||
|
||||
if (!ret) {
|
||||
actual_events = msg.data[1] & 0xffff;
|
||||
if (*events_cnt < actual_events)
|
||||
actual_events = *events_cnt;
|
||||
|
||||
for (; i < actual_events; i++)
|
||||
events[i] = msg.data[i + 2];
|
||||
|
||||
*events_cnt = actual_events;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue