[PATCH v2 22/22] firmware: ti: ti_sci_proc: Move processor ops into its own file

From: Beleswar Padhi

Date: Wed Sep 30 2026 - 12:24:37 EST


Extract the processor operations related functions and services from
ti_sci_core.c into its own file. This breaks down the single large
file into smaller logical files for better readability and maintenance.

Signed-off-by: Beleswar Padhi <b-padhi@xxxxxx>
---
v2: Changelog:
1. None to this patch.

Link to v1:
https://lore.kernel.org/all/20260929201746.4078803-23-b-padhi@xxxxxx/

drivers/firmware/ti/Makefile | 1 +
drivers/firmware/ti/ti_sci.h | 1 +
drivers/firmware/ti/ti_sci_core.c | 197 +--------------------------
drivers/firmware/ti/ti_sci_proc.c | 214 ++++++++++++++++++++++++++++++
4 files changed, 217 insertions(+), 196 deletions(-)
create mode 100644 drivers/firmware/ti/ti_sci_proc.c

diff --git a/drivers/firmware/ti/Makefile b/drivers/firmware/ti/Makefile
index 7d9c2a73bf5a6..8a32cb65b6fa5 100644
--- a/drivers/firmware/ti/Makefile
+++ b/drivers/firmware/ti/Makefile
@@ -4,5 +4,6 @@ ti_sci-y := ti_sci_core.o
ti_sci-y += ti_sci_clock.o
ti_sci-y += ti_sci_device.o
ti_sci-y += ti_sci_pm.o
+ti_sci-y += ti_sci_proc.o
ti_sci-y += ti_sci_rm.o
obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o
diff --git a/drivers/firmware/ti/ti_sci.h b/drivers/firmware/ti/ti_sci.h
index e8d6589eec0e9..8f9f0b1aa767d 100644
--- a/drivers/firmware/ti/ti_sci.h
+++ b/drivers/firmware/ti/ti_sci.h
@@ -1687,5 +1687,6 @@ int ti_sci_manage_irq(const struct ti_sci_handle *handle, u32 valid_params,
u16 src_id, u16 src_index, u16 dst_id, u16 dst_host_irq,
u16 ia_id, u16 vint, u16 global_event, u8 vint_status_bit,
u8 s_host, u16 type);
+void ti_sci_setup_proc_ops(struct ti_sci_proc_ops *pops);

#endif /* __TI_SCI_H */
diff --git a/drivers/firmware/ti/ti_sci_core.c b/drivers/firmware/ti/ti_sci_core.c
index b1345e06341db..1f7484b118375 100644
--- a/drivers/firmware/ti/ti_sci_core.c
+++ b/drivers/firmware/ti/ti_sci_core.c
@@ -620,195 +620,6 @@ static int ti_sci_cmd_core_reboot(const struct ti_sci_handle *handle)
return 0;
}

-/**
- * ti_sci_cmd_proc_request() - Command to request a physical processor control
- * @handle: Pointer to TI SCI handle
- * @proc_id: Processor ID this request is for
- *
- * Return: 0 if all went well, else returns appropriate error value.
- */
-static int ti_sci_cmd_proc_request(const struct ti_sci_handle *handle,
- u8 proc_id)
-{
- struct ti_sci_msg_req_proc_request req;
- struct ti_sci_msg_hdr resp;
- int ret = 0;
-
- req.processor_id = proc_id;
-
- ret = ti_sci_do_xfer(handle, TI_SCI_MSG_PROC_REQUEST,
- TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
- &req, sizeof(req),
- &resp, sizeof(resp));
- if (ret)
- return ret;
-
- return 0;
-}
-
-/**
- * ti_sci_cmd_proc_release() - Command to release a physical processor control
- * @handle: Pointer to TI SCI handle
- * @proc_id: Processor ID this request is for
- *
- * Return: 0 if all went well, else returns appropriate error value.
- */
-static int ti_sci_cmd_proc_release(const struct ti_sci_handle *handle,
- u8 proc_id)
-{
- struct ti_sci_msg_req_proc_release req;
- struct ti_sci_msg_hdr resp;
- int ret = 0;
-
- req.processor_id = proc_id;
-
- ret = ti_sci_do_xfer(handle, TI_SCI_MSG_PROC_RELEASE,
- TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
- &req, sizeof(req),
- &resp, sizeof(resp));
- if (ret)
- return ret;
-
- return 0;
-}
-
-/**
- * ti_sci_cmd_proc_handover() - Command to handover a physical processor
- * control to a host in the processor's access
- * control list.
- * @handle: Pointer to TI SCI handle
- * @proc_id: Processor ID this request is for
- * @host_id: Host ID to get the control of the processor
- *
- * Return: 0 if all went well, else returns appropriate error value.
- */
-static int ti_sci_cmd_proc_handover(const struct ti_sci_handle *handle,
- u8 proc_id, u8 host_id)
-{
- struct ti_sci_msg_req_proc_handover req;
- struct ti_sci_msg_hdr resp;
- int ret = 0;
-
- req.processor_id = proc_id;
- req.host_id = host_id;
-
- ret = ti_sci_do_xfer(handle, TI_SCI_MSG_PROC_HANDOVER,
- TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
- &req, sizeof(req),
- &resp, sizeof(resp));
- if (ret)
- return ret;
-
- return 0;
-}
-
-/**
- * ti_sci_cmd_proc_set_config() - Command to set the processor boot
- * configuration flags
- * @handle: Pointer to TI SCI handle
- * @proc_id: Processor ID this request is for
- * @bootvector: Processor Boot vector (start address)
- * @config_flags_set: Configuration flags to be set
- * @config_flags_clear: Configuration flags to be cleared.
- *
- * Return: 0 if all went well, else returns appropriate error value.
- */
-static int ti_sci_cmd_proc_set_config(const struct ti_sci_handle *handle,
- u8 proc_id, u64 bootvector,
- u32 config_flags_set,
- u32 config_flags_clear)
-{
- struct ti_sci_msg_req_set_config req;
- struct ti_sci_msg_hdr resp;
- int ret = 0;
-
- req.processor_id = proc_id;
- req.bootvector_low = bootvector & TI_SCI_ADDR_LOW_MASK;
- req.bootvector_high = (bootvector & TI_SCI_ADDR_HIGH_MASK) >>
- TI_SCI_ADDR_HIGH_SHIFT;
- req.config_flags_set = config_flags_set;
- req.config_flags_clear = config_flags_clear;
-
- ret = ti_sci_do_xfer(handle, TI_SCI_MSG_SET_CONFIG,
- TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
- &req, sizeof(req),
- &resp, sizeof(resp));
- if (ret)
- return ret;
-
- return 0;
-}
-
-/**
- * ti_sci_cmd_proc_set_control() - Command to set the processor boot
- * control flags
- * @handle: Pointer to TI SCI handle
- * @proc_id: Processor ID this request is for
- * @control_flags_set: Control flags to be set
- * @control_flags_clear: Control flags to be cleared
- *
- * Return: 0 if all went well, else returns appropriate error value.
- */
-static int ti_sci_cmd_proc_set_control(const struct ti_sci_handle *handle,
- u8 proc_id, u32 control_flags_set,
- u32 control_flags_clear)
-{
- struct ti_sci_msg_req_set_ctrl req;
- struct ti_sci_msg_hdr resp;
- int ret = 0;
-
- req.processor_id = proc_id;
- req.control_flags_set = control_flags_set;
- req.control_flags_clear = control_flags_clear;
-
- ret = ti_sci_do_xfer(handle, TI_SCI_MSG_SET_CTRL,
- TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
- &req, sizeof(req),
- &resp, sizeof(resp));
- if (ret)
- return ret;
-
- return 0;
-}
-
-/**
- * ti_sci_cmd_proc_get_status() - Command to get the processor boot status
- * @handle: Pointer to TI SCI handle
- * @proc_id: Processor ID this request is for
- * @bv: Processor Boot vector (start address)
- * @cfg_flags: Processor specific configuration flags
- * @ctrl_flags: Processor specific control flags
- * @sts_flags: Processor specific status flags
- *
- * Return: 0 if all went well, else returns appropriate error value.
- */
-static int ti_sci_cmd_proc_get_status(const struct ti_sci_handle *handle,
- u8 proc_id, u64 *bv, u32 *cfg_flags,
- u32 *ctrl_flags, u32 *sts_flags)
-{
- struct ti_sci_msg_resp_get_status resp;
- struct ti_sci_msg_req_get_status req;
- int ret = 0;
-
- req.processor_id = proc_id;
-
- ret = ti_sci_do_xfer(handle, TI_SCI_MSG_GET_STATUS,
- TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
- &req, sizeof(req),
- &resp, sizeof(resp));
- if (ret)
- return ret;
-
- *bv = (resp.bootvector_low & TI_SCI_ADDR_LOW_MASK) |
- (((u64)resp.bootvector_high << TI_SCI_ADDR_HIGH_SHIFT) &
- TI_SCI_ADDR_HIGH_MASK);
- *cfg_flags = resp.config_flags;
- *ctrl_flags = resp.control_flags;
- *sts_flags = resp.status_flags;
-
- return 0;
-}
-
/*
* ti_sci_setup_ops() - Setup the operations structures
* @info: pointer to TISCI pointer
@@ -839,13 +650,7 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
ti_sci_setup_rm_ringacc_ops(rops);
ti_sci_setup_rm_psil_ops(psilops);
ti_sci_setup_rm_udmap_ops(udmap_ops);
-
- pops->request = ti_sci_cmd_proc_request;
- pops->release = ti_sci_cmd_proc_release;
- pops->handover = ti_sci_cmd_proc_handover;
- pops->set_config = ti_sci_cmd_proc_set_config;
- pops->set_control = ti_sci_cmd_proc_set_control;
- pops->get_status = ti_sci_cmd_proc_get_status;
+ ti_sci_setup_proc_ops(pops);
}

/**
diff --git a/drivers/firmware/ti/ti_sci_proc.c b/drivers/firmware/ti/ti_sci_proc.c
new file mode 100644
index 0000000000000..6c0430f7b444a
--- /dev/null
+++ b/drivers/firmware/ti/ti_sci_proc.c
@@ -0,0 +1,214 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Texas Instruments System Control Interface Protocol Driver
+ *
+ * Copyright (C) 2015-2026 Texas Instruments Incorporated - https://www.ti.com/
+ * Nishanth Menon
+ */
+
+#include <linux/soc/ti/ti_sci_protocol.h>
+
+#include "ti_sci.h"
+
+/**
+ * ti_sci_cmd_proc_request() - Command to request a physical processor control
+ * @handle: Pointer to TI SCI handle
+ * @proc_id: Processor ID this request is for
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_request(const struct ti_sci_handle *handle,
+ u8 proc_id)
+{
+ struct ti_sci_msg_req_proc_request req;
+ struct ti_sci_msg_hdr resp;
+ int ret = 0;
+
+ req.processor_id = proc_id;
+
+ ret = ti_sci_do_xfer(handle, TI_SCI_MSG_PROC_REQUEST,
+ TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+ &req, sizeof(req),
+ &resp, sizeof(resp));
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+/**
+ * ti_sci_cmd_proc_release() - Command to release a physical processor control
+ * @handle: Pointer to TI SCI handle
+ * @proc_id: Processor ID this request is for
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_release(const struct ti_sci_handle *handle,
+ u8 proc_id)
+{
+ struct ti_sci_msg_req_proc_release req;
+ struct ti_sci_msg_hdr resp;
+ int ret = 0;
+
+ req.processor_id = proc_id;
+
+ ret = ti_sci_do_xfer(handle, TI_SCI_MSG_PROC_RELEASE,
+ TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+ &req, sizeof(req),
+ &resp, sizeof(resp));
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+/**
+ * ti_sci_cmd_proc_handover() - Command to handover a physical processor
+ * control to a host in the processor's access
+ * control list.
+ * @handle: Pointer to TI SCI handle
+ * @proc_id: Processor ID this request is for
+ * @host_id: Host ID to get the control of the processor
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_handover(const struct ti_sci_handle *handle,
+ u8 proc_id, u8 host_id)
+{
+ struct ti_sci_msg_req_proc_handover req;
+ struct ti_sci_msg_hdr resp;
+ int ret = 0;
+
+ req.processor_id = proc_id;
+ req.host_id = host_id;
+
+ ret = ti_sci_do_xfer(handle, TI_SCI_MSG_PROC_HANDOVER,
+ TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+ &req, sizeof(req),
+ &resp, sizeof(resp));
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+/**
+ * ti_sci_cmd_proc_set_config() - Command to set the processor boot
+ * configuration flags
+ * @handle: Pointer to TI SCI handle
+ * @proc_id: Processor ID this request is for
+ * @bootvector: Processor Boot vector (start address)
+ * @config_flags_set: Configuration flags to be set
+ * @config_flags_clear: Configuration flags to be cleared.
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_set_config(const struct ti_sci_handle *handle,
+ u8 proc_id, u64 bootvector,
+ u32 config_flags_set,
+ u32 config_flags_clear)
+{
+ struct ti_sci_msg_req_set_config req;
+ struct ti_sci_msg_hdr resp;
+ int ret = 0;
+
+ req.processor_id = proc_id;
+ req.bootvector_low = bootvector & TI_SCI_ADDR_LOW_MASK;
+ req.bootvector_high = (bootvector & TI_SCI_ADDR_HIGH_MASK) >>
+ TI_SCI_ADDR_HIGH_SHIFT;
+ req.config_flags_set = config_flags_set;
+ req.config_flags_clear = config_flags_clear;
+
+ ret = ti_sci_do_xfer(handle, TI_SCI_MSG_SET_CONFIG,
+ TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+ &req, sizeof(req),
+ &resp, sizeof(resp));
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+/**
+ * ti_sci_cmd_proc_set_control() - Command to set the processor boot
+ * control flags
+ * @handle: Pointer to TI SCI handle
+ * @proc_id: Processor ID this request is for
+ * @control_flags_set: Control flags to be set
+ * @control_flags_clear: Control flags to be cleared
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_set_control(const struct ti_sci_handle *handle,
+ u8 proc_id, u32 control_flags_set,
+ u32 control_flags_clear)
+{
+ struct ti_sci_msg_req_set_ctrl req;
+ struct ti_sci_msg_hdr resp;
+ int ret = 0;
+
+ req.processor_id = proc_id;
+ req.control_flags_set = control_flags_set;
+ req.control_flags_clear = control_flags_clear;
+
+ ret = ti_sci_do_xfer(handle, TI_SCI_MSG_SET_CTRL,
+ TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+ &req, sizeof(req),
+ &resp, sizeof(resp));
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+/**
+ * ti_sci_cmd_proc_get_status() - Command to get the processor boot status
+ * @handle: Pointer to TI SCI handle
+ * @proc_id: Processor ID this request is for
+ * @bv: Processor Boot vector (start address)
+ * @cfg_flags: Processor specific configuration flags
+ * @ctrl_flags: Processor specific control flags
+ * @sts_flags: Processor specific status flags
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_proc_get_status(const struct ti_sci_handle *handle,
+ u8 proc_id, u64 *bv, u32 *cfg_flags,
+ u32 *ctrl_flags, u32 *sts_flags)
+{
+ struct ti_sci_msg_resp_get_status resp;
+ struct ti_sci_msg_req_get_status req;
+ int ret = 0;
+
+ req.processor_id = proc_id;
+
+ ret = ti_sci_do_xfer(handle, TI_SCI_MSG_GET_STATUS,
+ TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+ &req, sizeof(req),
+ &resp, sizeof(resp));
+ if (ret)
+ return ret;
+
+ *bv = (resp.bootvector_low & TI_SCI_ADDR_LOW_MASK) |
+ (((u64)resp.bootvector_high << TI_SCI_ADDR_HIGH_SHIFT) &
+ TI_SCI_ADDR_HIGH_MASK);
+ *cfg_flags = resp.config_flags;
+ *ctrl_flags = resp.control_flags;
+ *sts_flags = resp.status_flags;
+
+ return 0;
+}
+
+/*
+ * ti_sci_setup_proc_ops() - Setup the processor operations structures
+ * @pops: pointer to TISCI processor ops structure
+ */
+void ti_sci_setup_proc_ops(struct ti_sci_proc_ops *pops)
+{
+ pops->request = ti_sci_cmd_proc_request;
+ pops->release = ti_sci_cmd_proc_release;
+ pops->handover = ti_sci_cmd_proc_handover;
+ pops->set_config = ti_sci_cmd_proc_set_config;
+ pops->set_control = ti_sci_cmd_proc_set_control;
+ pops->get_status = ti_sci_cmd_proc_get_status;
+}
--
2.34.1