[PATCH 06/11] lib: utils/mpxy: Simplify fdt_mpxy_rpmi.h by moving things to fdt_mpxy_rpmi.c

Pawandeep Oza pawandeep.oza at oss.qualcomm.com
Tue Oct 13 12:46:50 PDT 2026


On Tue, Sep 22, 2026 at 8:24 PM Anup Patel <anup.patel at oss.qualcomm.com> wrote:
>
> Currently, the fdt_mpxy_rpmi.h has lot things which are not used by
> any of MPXY RPMI drivers so simplify fdt_mpxy_rpmi.h by moving such
> things to fdt_mpxy_rpmi.c.
>
> Signed-off-by: Anup Patel <anup.patel at oss.qualcomm.com>
> ---
>  include/sbi_utils/mpxy/fdt_mpxy_rpmi.h      | 41 +--------------------
>  lib/utils/mpxy/fdt_mpxy_rpmi.c              | 41 ++++++++++++++++++++-
>  lib/utils/mpxy/fdt_mpxy_rpmi_clock.c        |  1 +
>  lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c |  1 +
>  lib/utils/mpxy/fdt_mpxy_rpmi_logging.c      |  1 +
>  lib/utils/mpxy/fdt_mpxy_rpmi_mm.c           |  1 +
>  lib/utils/mpxy/fdt_mpxy_rpmi_performance.c  |  1 +
>  lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c       |  1 +
>  lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c      |  1 +
>  9 files changed, 49 insertions(+), 40 deletions(-)
>
> diff --git a/include/sbi_utils/mpxy/fdt_mpxy_rpmi.h b/include/sbi_utils/mpxy/fdt_mpxy_rpmi.h
> index c4e6897f..ae7e537a 100644
> --- a/include/sbi_utils/mpxy/fdt_mpxy_rpmi.h
> +++ b/include/sbi_utils/mpxy/fdt_mpxy_rpmi.h
> @@ -10,47 +10,10 @@
>  #ifndef __FDT_MPXY_RPMI_H__
>  #define __FDT_MPXY_RPMI_H__
>
> -#include <sbi/sbi_types.h>
> -#include <sbi/sbi_mpxy.h>
> -#include <sbi_utils/mailbox/fdt_mailbox.h>
>  #include <sbi_utils/mailbox/rpmi_msgprot.h>
> -#include <sbi_utils/mpxy/fdt_mpxy.h>
>
> -/** Convert the mpxy attribute ID to attribute array index */
> -#define attr_id2index(attr_id) (attr_id - SBI_MPXY_ATTR_MSGPROTO_ATTR_START)
> -
> -enum mpxy_msgprot_rpmi_attr_id {
> -       MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_ID = SBI_MPXY_ATTR_MSGPROTO_ATTR_START,
> -       MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_VERSION,
> -       MPXY_MSGPROT_RPMI_ATTR_IMPL_ID,
> -       MPXY_MSGPROT_RPMI_ATTR_IMPL_VERSION,
> -       MPXY_MSGPROT_RPMI_ATTR_MAX_ID
> -};
> -
> -/**
> - * MPXY message protocol attributes for RPMI
> - * Order of attribute fields must follow the
> - * attribute IDs in `enum mpxy_msgprot_rpmi_attr_id`
> - */
> -struct mpxy_rpmi_channel_attrs {
> -       u32 servicegrp_id;
> -       u32 servicegrp_ver;
> -       u32 impl_id;
> -       u32 impl_ver;
> -};
> -
> -/** Make sure all attributes are packed for direct memcpy */
> -#define assert_field_offset(field, attr_offset)                                \
> -       _Static_assert(                                                 \
> -               ((offsetof(struct mpxy_rpmi_channel_attrs, field)) /    \
> -                sizeof(u32)) == (attr_offset - SBI_MPXY_ATTR_MSGPROTO_ATTR_START),\
> -               "field " #field                                         \
> -               " from struct mpxy_rpmi_channel_attrs invalid offset, expected " #attr_offset)
> -
> -assert_field_offset(servicegrp_id, MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_ID);
> -assert_field_offset(servicegrp_ver, MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_VERSION);
> -assert_field_offset(impl_id, MPXY_MSGPROT_RPMI_ATTR_IMPL_ID);
> -assert_field_offset(impl_ver, MPXY_MSGPROT_RPMI_ATTR_IMPL_VERSION);
> +struct mbox_chan;
> +struct mbox_xfer;
>
>  /** MPXY RPMI service data for each service group */
>  struct mpxy_rpmi_service_data {
> diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi.c b/lib/utils/mpxy/fdt_mpxy_rpmi.c
> index 103ded13..c0493ecb 100644
> --- a/lib/utils/mpxy/fdt_mpxy_rpmi.c
> +++ b/lib/utils/mpxy/fdt_mpxy_rpmi.c
> @@ -9,11 +9,50 @@
>   */
>
>  #include <libfdt.h>
> +#include <sbi/sbi_domain.h>
>  #include <sbi/sbi_error.h>
>  #include <sbi/sbi_heap.h>
> +#include <sbi/sbi_mpxy.h>
>  #include <sbi_utils/fdt/fdt_helper.h>
> +#include <sbi_utils/mailbox/fdt_mailbox.h>
> +#include <sbi_utils/mpxy/fdt_mpxy.h>
>  #include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
> -#include <sbi/sbi_console.h>
> +
> +/** Convert the mpxy attribute ID to attribute array index */
> +#define attr_id2index(attr_id) (attr_id - SBI_MPXY_ATTR_MSGPROTO_ATTR_START)
> +
> +enum mpxy_msgprot_rpmi_attr_id {
> +       MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_ID = SBI_MPXY_ATTR_MSGPROTO_ATTR_START,
> +       MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_VERSION,
> +       MPXY_MSGPROT_RPMI_ATTR_IMPL_ID,
> +       MPXY_MSGPROT_RPMI_ATTR_IMPL_VERSION,
> +       MPXY_MSGPROT_RPMI_ATTR_MAX_ID
> +};
> +
> +/**
> + * MPXY message protocol attributes for RPMI
> + * Order of attribute fields must follow the
> + * attribute IDs in `enum mpxy_msgprot_rpmi_attr_id`
> + */
> +struct mpxy_rpmi_channel_attrs {
> +       u32 servicegrp_id;
> +       u32 servicegrp_ver;
> +       u32 impl_id;
> +       u32 impl_ver;
> +};
> +
> +/** Make sure all attributes are packed for direct memcpy */
> +#define assert_field_offset(field, attr_offset)                                \
> +       _Static_assert(                                                 \
> +               ((offsetof(struct mpxy_rpmi_channel_attrs, field)) /    \
> +                sizeof(u32)) == (attr_offset - SBI_MPXY_ATTR_MSGPROTO_ATTR_START),\
> +               "field " #field                                         \
> +               " from struct mpxy_rpmi_channel_attrs invalid offset, expected " #attr_offset)
> +
> +assert_field_offset(servicegrp_id, MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_ID);
> +assert_field_offset(servicegrp_ver, MPXY_MSGPROT_RPMI_ATTR_SERVICEGROUP_VERSION);
> +assert_field_offset(impl_id, MPXY_MSGPROT_RPMI_ATTR_IMPL_ID);
> +assert_field_offset(impl_ver, MPXY_MSGPROT_RPMI_ATTR_IMPL_VERSION);
>
>  /**
>   * MPXY RPMI instance per MPXY channel. This ties
> diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi_clock.c b/lib/utils/mpxy/fdt_mpxy_rpmi_clock.c
> index c9e77791..a27392d5 100644
> --- a/lib/utils/mpxy/fdt_mpxy_rpmi_clock.c
> +++ b/lib/utils/mpxy/fdt_mpxy_rpmi_clock.c
> @@ -8,6 +8,7 @@
>   *   Anup Patel <apatel at ventanamicro.com>
>   */
>
> +#include <sbi_utils/mpxy/fdt_mpxy.h>
>  #include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
>
>  static struct mpxy_rpmi_service_data clock_services[] = {
> diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c b/lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c
> index a2a3b99f..dcfaaafd 100644
> --- a/lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c
> +++ b/lib/utils/mpxy/fdt_mpxy_rpmi_device_power.c
> @@ -1,3 +1,4 @@
> +#include <sbi_utils/mpxy/fdt_mpxy.h>
>  #include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
>
>  static struct mpxy_rpmi_service_data dpwr_services[] = {
> diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi_logging.c b/lib/utils/mpxy/fdt_mpxy_rpmi_logging.c
> index 42bb1e14..7681dfe9 100644
> --- a/lib/utils/mpxy/fdt_mpxy_rpmi_logging.c
> +++ b/lib/utils/mpxy/fdt_mpxy_rpmi_logging.c
> @@ -7,6 +7,7 @@
>   *   Subrahmanya Lingappa <subrahmanya.lingappa at oss.qualcomm.com>
>   */
>
> +#include <sbi_utils/mpxy/fdt_mpxy.h>
>  #include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
>
>  static struct mpxy_rpmi_service_data logging_services[] = {
> diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi_mm.c b/lib/utils/mpxy/fdt_mpxy_rpmi_mm.c
> index 9b056458..0263a105 100644
> --- a/lib/utils/mpxy/fdt_mpxy_rpmi_mm.c
> +++ b/lib/utils/mpxy/fdt_mpxy_rpmi_mm.c
> @@ -8,6 +8,7 @@
>   *   Sunil V L <sunilvl at oss.qualcomm.com>
>   */
>
> +#include <sbi_utils/mpxy/fdt_mpxy.h>
>  #include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
>  #include <sbi_utils/mailbox/rpmi_mailbox.h>
>
> diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi_performance.c b/lib/utils/mpxy/fdt_mpxy_rpmi_performance.c
> index 9b2c60c5..673d5378 100644
> --- a/lib/utils/mpxy/fdt_mpxy_rpmi_performance.c
> +++ b/lib/utils/mpxy/fdt_mpxy_rpmi_performance.c
> @@ -1,3 +1,4 @@
> +#include <sbi_utils/mpxy/fdt_mpxy.h>
>  #include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
>
>  static struct mpxy_rpmi_service_data performance_services[] = {
> diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c b/lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c
> index 9a5b4ec0..f7c3c3db 100644
> --- a/lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c
> +++ b/lib/utils/mpxy/fdt_mpxy_rpmi_sysmsi.c
> @@ -9,6 +9,7 @@
>  #include <sbi/sbi_byteorder.h>
>  #include <sbi/sbi_heap.h>
>  #include <sbi_utils/mailbox/rpmi_mailbox.h>
> +#include <sbi_utils/mpxy/fdt_mpxy.h>
>  #include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
>
>  struct mpxy_rpmi_sysmsi {
> diff --git a/lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c b/lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c
> index fa640886..47488054 100644
> --- a/lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c
> +++ b/lib/utils/mpxy/fdt_mpxy_rpmi_voltage.c
> @@ -1,3 +1,4 @@
> +#include <sbi_utils/mpxy/fdt_mpxy.h>
>  #include <sbi_utils/mpxy/fdt_mpxy_rpmi.h>
>
>  static struct mpxy_rpmi_service_data voltage_services[] = {
> --
> 2.43.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi

Reviewed-by: Pawandeep Oza <pawandeep.oza at oss.qualcomm.com>
Tested-by: Pawandeep Oza <pawandeep.oza at oss.qualcomm.com>



More information about the opensbi mailing list