This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 10ebcaf51e1 drivers/rptun: select what RPTUNIOC_DUMP dumps
10ebcaf51e1 is described below

commit 10ebcaf51e1aa6fb2dbe82919fdf801f0d552d2a
Author: Bowen Wang <[email protected]>
AuthorDate: Tue Nov 17 15:06:10 2026 +0800

    drivers/rptun: select what RPTUNIOC_DUMP dumps
    
    RPTUNIOC_DUMP ignored its argument and only dumped the peer's syslog
    buffer. Make the argument a mask: RPTUN_DUMP_SYSLOG dumps the syslog
    buffer, as the halt notifier now asks for explicitly, and
    RPTUN_DUMP_RSC prints the resource table with rptun_dump_resource().
    The new CONFIG_RPTUN_RSC_DUMP (default n) builds that call, so a build
    that does not need it keeps the resource dump code out.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/rptun/Kconfig       |  7 +++++++
 drivers/rptun/rptun.c       | 18 ++++++++++++++----
 include/nuttx/rptun/rptun.h |  5 +++++
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/drivers/rptun/Kconfig b/drivers/rptun/Kconfig
index 43384d72595..fb40020152b 100644
--- a/drivers/rptun/Kconfig
+++ b/drivers/rptun/Kconfig
@@ -160,4 +160,11 @@ config RPTUN_TRACE_DUMP
                Print the remote core's syslog buffer (its RSC_TRACE entry) on
                halt and on RPTUNIOC_DUMP.
 
+config RPTUN_RSC_DUMP
+       bool "rptun dump the resource table"
+       default n
+       ---help---
+               Let RPTUNIOC_DUMP with RPTUN_DUMP_RSC print the resource table
+               through rptun_dump_resource().
+
 endif # RPTUN
diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c
index dade8aaac7f..320c522b6e3 100644
--- a/drivers/rptun/rptun.c
+++ b/drivers/rptun/rptun.c
@@ -1374,10 +1374,20 @@ static int rptun_dev_reset(FAR struct rptun_priv_s 
*priv, unsigned long val)
   return ret;
 }
 
-static void rptun_dev_dump(FAR struct rptun_priv_s *priv)
+static void rptun_dev_dump(FAR struct rptun_priv_s *priv,
+                           unsigned long arg)
 {
+  UNUSED(arg);
+
+#ifdef CONFIG_RPTUN_RSC_DUMP
+  if (arg & RPTUN_DUMP_RSC)
+    {
+      rptun_dump_resource(priv->rproc.rsc_table);
+    }
+#endif
+
 #if defined(CONFIG_SYSLOG_RPMSG_SERVER) && defined(CONFIG_RPTUN_TRACE_DUMP)
-  if (priv->trace_va != NULL)
+  if ((arg & RPTUN_DUMP_SYSLOG) && priv->trace_va != NULL)
     {
       _emerg("Dump %s's trace\n", RPTUN_GET_CPUNAME(priv->dev));
       syslog_rpmsg_dump(priv->trace_va);
@@ -1413,7 +1423,7 @@ static int rptun_do_ioctl(FAR struct rptun_priv_s *priv, 
int cmd,
         ret = rptun_dev_reset(priv, arg);
         break;
       case RPTUNIOC_DUMP:
-        rptun_dev_dump(priv);
+        rptun_dev_dump(priv, arg);
         break;
       default:
         ret = -ENOTTY;
@@ -1693,7 +1703,7 @@ static int rptun_notifier(FAR struct notifier_block 
*block,
 
       if (action == SYS_HALT)
         {
-          rptun_ioctl_foreach(NULL, RPTUNIOC_DUMP, 0);
+          rptun_ioctl_foreach(NULL, RPTUNIOC_DUMP, RPTUN_DUMP_SYSLOG);
         }
     }
   else if (action == PANIC_KERNEL)
diff --git a/include/nuttx/rptun/rptun.h b/include/nuttx/rptun/rptun.h
index 9640c884468..764f634dfee 100644
--- a/include/nuttx/rptun/rptun.h
+++ b/include/nuttx/rptun/rptun.h
@@ -48,6 +48,11 @@
 #define RPTUNIOC_RESET        _RPTUNIOC(3)
 #define RPTUNIOC_DUMP         _RPTUNIOC(4)
 
+/* RPTUNIOC_DUMP argument: a mask of what to dump */
+
+#define RPTUN_DUMP_SYSLOG     (1 << 0)  /* The peer's syslog in the trace */
+#define RPTUN_DUMP_RSC        (1 << 1)  /* The resource table */
+
 #define RPTUN_NOTIFY_ALL      UINT32_MAX
 
 #ifdef CONFIG_OPENAMP_CACHE

Reply via email to