From 33ee9b8240fee298ddd357a68096652286024670 Mon Sep 17 00:00:00 2001 From: Subrahmanya Lingappa Date: Tue, 6 Aug 2024 10:55:01 +0530 Subject: lib: utils/hsm: Add RPMI HSM driver The RPMI HSM service group provides set of routine to query and control power states of a Hart. Add RPMI based Hart State Management (HSM) driver. Signed-off-by: Subrahmanya Lingappa Signed-off-by: Anup Patel --- include/sbi_utils/mailbox/rpmi_msgprot.h | 92 ++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'include') diff --git a/include/sbi_utils/mailbox/rpmi_msgprot.h b/include/sbi_utils/mailbox/rpmi_msgprot.h index 4de86adf..8e2b23e2 100644 --- a/include/sbi_utils/mailbox/rpmi_msgprot.h +++ b/include/sbi_utils/mailbox/rpmi_msgprot.h @@ -199,6 +199,7 @@ enum rpmi_servicegroup_id { RPMI_SRVGRP_BASE = 0x0001, RPMI_SRVGRP_SYSTEM_RESET = 0x0002, RPMI_SRVGRP_SYSTEM_SUSPEND = 0x0003, + RPMI_SRVGRP_HSM = 0x0004, RPMI_SRVGRP_ID_MAX_COUNT, /* Reserved range for service groups */ @@ -314,4 +315,95 @@ struct rpmi_syssusp_suspend_resp { s32 status; }; +/** RPMI HSM State Management ServiceGroup Service IDs */ +enum rpmi_hsm_service_id { + RPMI_HSM_SRV_ENABLE_NOTIFICATION = 0x01, + RPMI_HSM_SRV_GET_HART_STATUS = 0x02, + RPMI_HSM_SRV_GET_HART_LIST = 0x03, + RPMI_HSM_SRV_GET_SUSPEND_TYPES = 0x04, + RPMI_HSM_SRV_GET_SUSPEND_INFO = 0x05, + RPMI_HSM_SRV_HART_START = 0x06, + RPMI_HSM_SRV_HART_STOP = 0x07, + RPMI_HSM_SRV_HART_SUSPEND = 0x08, + RPMI_HSM_SRV_ID_MAX = 0x09, +}; + +/* HSM service group request and response structs */ +struct rpmi_hsm_hart_start_req { + u32 hartid; + u32 start_addr_lo; + u32 start_addr_hi; +}; + +struct rpmi_hsm_hart_start_resp { + s32 status; +}; + +struct rpmi_hsm_hart_stop_req { + u32 hartid; +}; + +struct rpmi_hsm_hart_stop_resp { + s32 status; +}; + +struct rpmi_hsm_hart_susp_req { + u32 hartid; + u32 suspend_type; + u32 resume_addr_lo; + u32 resume_addr_hi; +}; + +struct rpmi_hsm_hart_susp_resp { + s32 status; +}; + +struct rpmi_hsm_get_hart_status_req { + u32 hartid; +}; + +struct rpmi_hsm_get_hart_status_resp { + s32 status; + u32 hart_status; +}; + +struct rpmi_hsm_get_hart_list_req { + u32 start_index; +}; + +struct rpmi_hsm_get_hart_list_resp { + s32 status; + u32 remaining; + u32 returned; + /* remaining space need to be adjusted for the above 3 u32's */ + u32 hartid[(RPMI_MSG_DATA_SIZE(RPMI_SLOT_SIZE_MIN) - (sizeof(u32) * 3)) / sizeof(u32)]; +}; + +struct rpmi_hsm_get_susp_types_req { + u32 start_index; +}; + +struct rpmi_hsm_get_susp_types_resp { + s32 status; + u32 remaining; + u32 returned; + /* remaining space need to be adjusted for the above 3 u32's */ + u32 types[(RPMI_MSG_DATA_SIZE(RPMI_SLOT_SIZE_MIN) - (sizeof(u32) * 3)) / sizeof(u32)]; +}; + +struct rpmi_hsm_get_susp_info_req { + u32 suspend_type; +}; + +#define RPMI_HSM_SUSPEND_INFO_FLAGS_TIMER_STOP 1U + +struct rpmi_hsm_get_susp_info_resp { + s32 status; + u32 flags; + u32 entry_latency_us; + u32 exit_latency_us; + u32 wakeup_latency_us; + u32 min_residency_us; +}; + #endif /* !__RPMI_MSGPROT_H__ */ -- cgit v1.3.1