summaryrefslogtreecommitdiff
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
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>
-rw-r--r--board/kukui_scp/board.h3
-rw-r--r--chip/mt_scp/ipi.c11
-rw-r--r--chip/mt_scp/ipi_chip.h14
-rw-r--r--include/config.h3
4 files changed, 31 insertions, 0 deletions
diff --git a/board/kukui_scp/board.h b/board/kukui_scp/board.h
index 8edcfeb87b..53d92c4ec4 100644
--- a/board/kukui_scp/board.h
+++ b/board/kukui_scp/board.h
@@ -20,6 +20,7 @@
/* IPI configs */
#define CONFIG_IPI
+#define CONFIG_RPMSG_NAME_SERVICE
/* IPI ID should be in sync across kernel and EC. */
#define IPI_SCP_INIT 0
@@ -32,6 +33,8 @@
#define IPI_HOST_COMMAND 7
#define IPI_COUNT 8
+#define IPI_NS_SERVICE 0xFF
+
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 8192
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.
*/
diff --git a/include/config.h b/include/config.h
index 122523a5e9..3b0302b2ae 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2081,6 +2081,9 @@
/* "buffer" size of ipc_shared_obj. */
#undef CONFIG_IPC_SHARED_OBJ_BUF_SIZE
+/* EC support rpmsg name service over IPI. */
+#undef CONFIG_RPMSG_NAME_SERVICE
+
/*****************************************************************************/
/* Current/Power monitor */