aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSubrahmanya Lingappa <slingappa@ventanamicro.com>2024-08-07 10:54:01 +0530
committerAnup Patel <anup@brainfault.org>2024-12-06 09:26:47 +0530
commit591a98bdd549b20504ffda41a41346ad2248ea4d (patch)
tree34a0c82f9dc0181739377edadd541082a8f46e94 /include
parent54e632b72e80101cf733c47ad1c419d23a8b78e7 (diff)
downloadopensbi-591a98bdd549b20504ffda41a41346ad2248ea4d.tar.gz
opensbi-591a98bdd549b20504ffda41a41346ad2248ea4d.tar.bz2
opensbi-591a98bdd549b20504ffda41a41346ad2248ea4d.zip
lib: utils/cppc: Add RPMI CPPC driver
Add RPMI based driver for CPPC register read, write and probe. Signed-off-by: Subrahmanya Lingappa <slingappa@ventanamicro.com> Co-developed-by: Rahul Pathak <rpathak@ventanamicro.com> Signed-off-by: Rahul Pathak <rpathak@ventanamicro.com> Co-developed-by: Sunil V L <sunilvl@ventanamicro.com> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Diffstat (limited to 'include')
-rw-r--r--include/sbi_utils/mailbox/rpmi_msgprot.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/include/sbi_utils/mailbox/rpmi_msgprot.h b/include/sbi_utils/mailbox/rpmi_msgprot.h
index 8e2b23e2..f7c80360 100644
--- a/include/sbi_utils/mailbox/rpmi_msgprot.h
+++ b/include/sbi_utils/mailbox/rpmi_msgprot.h
@@ -200,6 +200,7 @@ enum rpmi_servicegroup_id {
RPMI_SRVGRP_SYSTEM_RESET = 0x0002,
RPMI_SRVGRP_SYSTEM_SUSPEND = 0x0003,
RPMI_SRVGRP_HSM = 0x0004,
+ RPMI_SRVGRP_CPPC = 0x0005,
RPMI_SRVGRP_ID_MAX_COUNT,
/* Reserved range for service groups */
@@ -406,4 +407,108 @@ struct rpmi_hsm_get_susp_info_resp {
u32 min_residency_us;
};
+/** RPMI CPPC ServiceGroup Service IDs */
+enum rpmi_cppc_service_id {
+ RPMI_CPPC_SRV_ENABLE_NOTIFICATION = 0x01,
+ RPMI_CPPC_SRV_PROBE_REG = 0x02,
+ RPMI_CPPC_SRV_READ_REG = 0x03,
+ RPMI_CPPC_SRV_WRITE_REG = 0x04,
+ RPMI_CPPC_SRV_GET_FAST_CHANNEL_REGION = 0x05,
+ RPMI_CPPC_SRV_GET_FAST_CHANNEL_OFFSET = 0x06,
+ RPMI_CPPC_SRV_GET_HART_LIST = 0x07,
+ RPMI_CPPC_SRV_MAX_COUNT,
+};
+
+struct rpmi_cppc_probe_req {
+ u32 hart_id;
+ u32 reg_id;
+};
+
+struct rpmi_cppc_probe_resp {
+ s32 status;
+ u32 reg_len;
+};
+
+struct rpmi_cppc_read_reg_req {
+ u32 hart_id;
+ u32 reg_id;
+};
+
+struct rpmi_cppc_read_reg_resp {
+ s32 status;
+ u32 data_lo;
+ u32 data_hi;
+};
+
+struct rpmi_cppc_write_reg_req {
+ u32 hart_id;
+ u32 reg_id;
+ u32 data_lo;
+ u32 data_hi;
+};
+
+struct rpmi_cppc_write_reg_resp {
+ s32 status;
+};
+
+struct rpmi_cppc_get_fastchan_offset_req {
+ u32 hart_id;
+};
+
+struct rpmi_cppc_get_fastchan_offset_resp {
+ s32 status;
+ u32 fc_perf_request_offset_lo;
+ u32 fc_perf_request_offset_hi;
+ u32 fc_perf_feedback_offset_lo;
+ u32 fc_perf_feedback_offset_hi;
+};
+
+#define RPMI_CPPC_FAST_CHANNEL_CPPC_MODE_POS 3
+#define RPMI_CPPC_FAST_CHANNEL_CPPC_MODE_MASK \
+ (3U << RPMI_CPPC_FAST_CHANNEL_CPPC_MODE_POS)
+#define RPMI_CPPC_FAST_CHANNEL_FLAGS_DB_WIDTH_POS 1
+#define RPMI_CPPC_FAST_CHANNEL_FLAGS_DB_WIDTH_MASK \
+ (3U << RPMI_CPPC_FAST_CHANNEL_FLAGS_DB_WIDTH_POS)
+#define RPMI_CPPC_FAST_CHANNEL_FLAGS_DB_SUPPORTED (1U << 0)
+
+struct rpmi_cppc_get_fastchan_region_resp {
+ s32 status;
+ u32 flags;
+ u32 region_addr_lo;
+ u32 region_addr_hi;
+ u32 region_size_lo;
+ u32 region_size_hi;
+ u32 db_addr_lo;
+ u32 db_addr_hi;
+ u32 db_setmask_lo;
+ u32 db_setmask_hi;
+ u32 db_preservemask_lo;
+ u32 db_preservemask_hi;
+};
+
+enum rpmi_cppc_fast_channel_db_width {
+ RPMI_CPPC_FAST_CHANNEL_DB_WIDTH_8 = 0x0,
+ RPMI_CPPC_FAST_CHANNEL_DB_WIDTH_16 = 0x1,
+ RPMI_CPPC_FAST_CHANNEL_DB_WIDTH_32 = 0x2,
+ RPMI_CPPC_FAST_CHANNEL_DB_WIDTH_64 = 0x3,
+};
+
+enum rpmi_cppc_fast_channel_cppc_mode {
+ RPMI_CPPC_FAST_CHANNEL_CPPC_MODE_PASSIVE = 0x0,
+ RPMI_CPPC_FAST_CHANNEL_CPPC_MODE_ACTIVE = 0x1,
+ RPMI_CPPC_FAST_CHANNEL_CPPC_MODE_MAX_IDX,
+};
+
+struct rpmi_cppc_hart_list_req {
+ u32 start_index;
+};
+
+struct rpmi_cppc_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)];
+};
+
#endif /* !__RPMI_MSGPROT_H__ */