From a23d954e3e245d511349531f5d8f53308becc85f Mon Sep 17 00:00:00 2001 From: Mahesh Kumar Date: Thu, 26 Dec 2024 06:01:21 +0000 Subject: [PATCH] platform: dce: Add bootsrap2 command Add support to the bootstrap command over the admin channel, which will be called when a client registers. This command will perform steps that must be performed only after the client is ready. TODO: This bootstrap-2 command will be replaced by the existing bootstrap command which we call during DCE-FW bootstrapping once we split admin bootstrapping and RM bootstrapping in the DCE-KMD. Jira TDS-17135 Change-Id: I55330b9ce73e1acf20e2a80d392d7984c91ed65f Signed-off-by: Mahesh Kumar Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3274949 Reviewed-by: Vinod Gopalakrishnakurup GVS: buildbot_gerritrpt Reviewed-by: svcacv --- drivers/platform/tegra/dce/dce-admin.c | 40 +++++++++++++++++++ drivers/platform/tegra/dce/include/dce.h | 2 + .../dce/include/interface/dce-admin-cmds.h | 3 +- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/platform/tegra/dce/dce-admin.c b/drivers/platform/tegra/dce/dce-admin.c index 1e72dd7d..21857cfc 100644 --- a/drivers/platform/tegra/dce/dce-admin.c +++ b/drivers/platform/tegra/dce/dce-admin.c @@ -665,6 +665,46 @@ int dce_admin_get_ipc_channel_info(struct tegra_dce *d, return ret; } +/** + * dce_admin_send_bootstrap2 - Sends DCE_ADMIN_CMD_RM_BOOTSTRAP2 cmd. + * + * @d - Pointer to tegra_dce struct. + * @msg - Pointer to dce_ipc_msg struct. + * + * Return - 0 if successful + */ +int dce_admin_send_cmd_rm_bootstrap(struct tegra_dce *d, + struct dce_ipc_message *msg) +{ + int ret = -1; + struct dce_admin_ipc_cmd *req_msg; + struct dce_admin_ipc_resp *resp_msg; + + if (!msg || !msg->tx.data || !msg->rx.data) + goto out; + + /* return if dce bootstrap not completed */ + if (!dce_is_bootstrap_done(d)) { + dce_os_err(d, "Admin Bootstrap not yet done"); + goto out; + } + + req_msg = (struct dce_admin_ipc_cmd *)(msg->tx.data); + resp_msg = (struct dce_admin_ipc_resp *) (msg->rx.data); + + req_msg->cmd = (uint32_t)DCE_ADMIN_CMD_RM_BOOTSTRAP2; + + ret = dce_admin_send_msg(d, msg); + if ((ret) || (resp_msg->error != DCE_ERR_CORE_SUCCESS)) { + dce_os_err(d, "Error sending bootstrap msg : [%d]", ret); + ret = ret ? ret : resp_msg->error; + goto out; + } + +out: + return ret; +} + /** * dce_admin_send_cmd_echo - Sends DCE_ADMIN_CMD_ECHO cmd. * diff --git a/drivers/platform/tegra/dce/include/dce.h b/drivers/platform/tegra/dce/include/dce.h index 96380047..1f2a4ab9 100644 --- a/drivers/platform/tegra/dce/include/dce.h +++ b/drivers/platform/tegra/dce/include/dce.h @@ -401,6 +401,8 @@ int dce_admin_get_ipc_channel_info(struct tegra_dce *d, struct dce_ipc_queue_info *q_info); int dce_admin_send_cmd_echo(struct tegra_dce *d, struct dce_ipc_message *msg); +int dce_admin_send_cmd_rm_bootstrap(struct tegra_dce *d, + struct dce_ipc_message *msg); int dce_admin_send_cmd_ext_test(struct tegra_dce *d, struct dce_ipc_message *msg); int dce_admin_send_prepare_sc7(struct tegra_dce *d, diff --git a/drivers/platform/tegra/dce/include/interface/dce-admin-cmds.h b/drivers/platform/tegra/dce/include/interface/dce-admin-cmds.h index dc7d69bc..8a6306fe 100644 --- a/drivers/platform/tegra/dce/include/interface/dce-admin-cmds.h +++ b/drivers/platform/tegra/dce/include/interface/dce-admin-cmds.h @@ -74,8 +74,9 @@ #define DCE_ADMIN_CMD_PERF_RESULTS 0x16U // copy out the perf results #define DCE_ADMIN_CMD_PERF_GET_EVENTS 0x17U // get perf events #define DCE_ADMIN_CMD_PERF_CLEAR_EVENTS 0x18U // clear perf events +#define DCE_ADMIN_CMD_RM_BOOTSTRAP2 0x19U // tell RM to "bootstrap" display-server -#define DCE_ADMIN_CMD_NEXT 0x19U // must be last command ID + 1 +#define DCE_ADMIN_CMD_NEXT 0x1AU // must be last command ID + 1 struct dce_admin_version_info { uint32_t version;