summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorPeter Shih <pihsun@chromium.org>2018-12-25 14:01:58 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-04 22:42:55 -0800
commit46222787a6b3c620836967f1010b8d22e1d96b31 (patch)
tree23eff08d9b1f0466450bc49cfcf76482e6643587 /chip
parent58fee9dbc2ef12bb436ceb18ad116ad2e421dd2d (diff)
downloadchrome-ec-46222787a6b3c620836967f1010b8d22e1d96b31.tar.gz
kukui_scp: Add rpmsg name service.
rpmsg name service provide a way for firmware to announce available rpmsg channels and its IPI id to AP, without AP having to hard-code all the IPI ids. BUG=b:120953723 TEST=manually BRANCH=none Change-Id: I8ec539a45b58f20e70a798ede4abaad5a7bb4360 Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1389986 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/mt_scp/ipi.c11
-rw-r--r--chip/mt_scp/ipi_chip.h14
2 files changed, 25 insertions, 0 deletions
diff --git a/chip/mt_scp/ipi.c b/chip/mt_scp/ipi.c
index a8bfce0a11..5ec49d318d 100644
--- a/chip/mt_scp/ipi.c
+++ b/chip/mt_scp/ipi.c
@@ -131,6 +131,9 @@ void ipi_inform_ap(void)
{
struct scp_run_t scp_run;
int ret;
+#ifdef CONFIG_RPMSG_NAME_SERVICE
+ struct rpmsg_ns_msg ns_msg;
+#endif
scp_run.signaled = 1;
strncpy(scp_run.fw_ver, system_get_version(SYSTEM_IMAGE_RW),
@@ -142,6 +145,14 @@ void ipi_inform_ap(void)
if (ret)
ccprintf("Failed to send initialization IPC messages.\n");
+
+#ifdef CONFIG_RPMSG_NAME_SERVICE
+ ns_msg.id = IPI_HOST_COMMAND;
+ strncpy(ns_msg.name, "cros-ec-rpmsg", RPMSG_NAME_SIZE);
+ ret = ipi_send(IPI_NS_SERVICE, &ns_msg, sizeof(ns_msg), 1);
+ if (ret)
+ ccprintf("Failed to announce host command channel.\n");
+#endif
}
#ifdef HAS_TASK_HOSTCMD
diff --git a/chip/mt_scp/ipi_chip.h b/chip/mt_scp/ipi_chip.h
index 1c027b5d04..b6eeddfc87 100644
--- a/chip/mt_scp/ipi_chip.h
+++ b/chip/mt_scp/ipi_chip.h
@@ -49,6 +49,20 @@ struct ipc_shared_obj {
/* Send a IPI contents to AP. */
int ipi_send(int32_t id, void *buf, uint32_t len, int wait);
+/* Size of the rpmsg device name, should sync across kernel and EC. */
+#define RPMSG_NAME_SIZE 32
+
+/*
+ * The layout of name service message.
+ * This should sync across kernel and EC.
+ */
+struct rpmsg_ns_msg {
+ /* Name of the corresponding rpmsg_driver. */
+ char name[RPMSG_NAME_SIZE];
+ /* IPC ID */
+ uint32_t id;
+};
+
/*
* IPC Handler.
*/