diff options
| author | Joshua Yeong <[email protected]> | 2025-10-13 23:31:37 +0800 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2025-11-04 10:34:01 +0530 |
| commit | a28e51016e7715f2baeea18a07cef93a7cb603af (patch) | |
| tree | c6e1603fd44b54b3d87652761f915c6b1645bbfa /lib | |
| parent | fa911ebe72ec9f8b82947ebc99daf1d0ec2f53e2 (diff) | |
lib: utils: Add MPXY RPMI mailbox driver for device power
Add MPXY RPMI mailbox driver for device power.
Signed-off-by: Joshua Yeong <[email protected]>
Reviewed-by: Rahul Pathak <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils/mpxy/Kconfig | 4 | ||||
| -rw-r--r-- | lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c | 56 | ||||
| -rw-r--r-- | lib/utils/mpxy/objects.mk | 3 |
3 files changed, 63 insertions, 0 deletions
diff --git a/lib/utils/mpxy/Kconfig b/lib/utils/mpxy/Kconfig index f720af2c..25288671 100644 --- a/lib/utils/mpxy/Kconfig +++ b/lib/utils/mpxy/Kconfig @@ -26,6 +26,10 @@ config FDT_MPXY_RPMI_VOLTAGE bool "MPXY driver for RPMI voltage service group" default n +config FDT_MPXY_RPMI_DEVICE_POWER + bool "MPXY driver for RPMI device power service group" + default n + endif endmenu diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c b/lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c new file mode 100644 index 00000000..6ffcb403 --- /dev/null +++ b/lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c @@ -0,0 +1,56 @@ +#include <sbi_utils/mpxy/fdt_mpxy_rpmi_mbox.h> + +static struct mpxy_rpmi_service_data dpwr_services[] = { +{ + .id = RPMI_DPWR_SRV_ENABLE_NOTIFICATION, + .min_tx_len = sizeof(struct rpmi_enable_notification_req), + .max_tx_len = sizeof(struct rpmi_enable_notification_req), + .min_rx_len = sizeof(struct rpmi_enable_notification_resp), + .max_rx_len = sizeof(struct rpmi_enable_notification_resp), +}, +{ + .id = RPMI_DPWR_SRV_GET_NUM_DOMAINS, + .min_tx_len = 0, + .max_tx_len = 0, + .min_rx_len = sizeof(struct rpmi_dpwr_get_num_domain_resp), + .max_rx_len = sizeof(struct rpmi_dpwr_get_num_domain_resp), +}, +{ + .id = RPMI_DPWR_SRV_GET_ATTRIBUTES, + .min_tx_len = sizeof(struct rpmi_dpwr_get_attrs_req), + .max_tx_len = sizeof(struct rpmi_dpwr_get_attrs_req), + .min_rx_len = sizeof(struct rpmi_dpwr_get_attrs_resp), + .max_rx_len = sizeof(struct rpmi_dpwr_get_attrs_resp), +}, +{ + .id = RPMI_DPWR_SRV_SET_STATE, + .min_tx_len = sizeof(struct rpmi_dpwr_set_state_req), + .max_tx_len = sizeof(struct rpmi_dpwr_set_state_req), + .min_rx_len = sizeof(struct rpmi_dpwr_set_state_resp), + .max_rx_len = sizeof(struct rpmi_dpwr_set_state_resp), +}, +{ + .id = RPMI_DPWR_SRV_GET_STATE, + .min_tx_len = sizeof(struct rpmi_dpwr_get_state_req), + .max_tx_len = sizeof(struct rpmi_dpwr_get_state_req), + .min_rx_len = sizeof(struct rpmi_dpwr_get_state_resp), + .max_rx_len = sizeof(struct rpmi_dpwr_get_state_resp), +}, +}; + +static const struct mpxy_rpmi_mbox_data dpwr_data = { + .servicegrp_id = RPMI_SRVGRP_DEVICE_POWER, + .num_services = RPMI_DPWR_SRV_MAX_COUNT, + .service_data = dpwr_services, +}; + +static const struct fdt_match dpwr_match[] = { + { .compatible = "riscv,rpmi-mpxy-device-power", .data = &dpwr_data }, + { }, +}; + +const struct fdt_driver fdt_mpxy_rpmi_device_power = { + .experimental = true, + .match_table = dpwr_match, + .init = mpxy_rpmi_mbox_init, +}; diff --git a/lib/utils/mpxy/objects.mk b/lib/utils/mpxy/objects.mk index a71c56af..45b3281b 100644 --- a/lib/utils/mpxy/objects.mk +++ b/lib/utils/mpxy/objects.mk @@ -20,3 +20,6 @@ libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_SYSMSI) += mpxy/fdt_mpxy_rpmi_sysmsi.o carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_VOLTAGE) += fdt_mpxy_rpmi_voltage libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_VOLTAGE) += mpxy/fdt_mpxy_rpmi_voltage.o + +carray-fdt_mpxy_drivers-$(CONFIG_FDT_MPXY_RPMI_DEVICE_POWER) += fdt_mpxy_rpmi_device_power +libsbiutils-objs-$(CONFIG_FDT_MPXY_RPMI_DEVICE_POWER) += mpxy/fdt_mpxy_rpmi_device_power.o |
