]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
Merge patch series "Add 'trace wipe'"
authorTom Rini <trini@konsulko.com>
Wed, 1 Jan 2025 01:00:54 +0000 (19:00 -0600)
committerTom Rini <trini@konsulko.com>
Wed, 1 Jan 2025 16:40:33 +0000 (10:40 -0600)
Jerome Forissier <jerome.forissier@linaro.org> says:

This short series adds the 'trace wipe' command which clears the trace
buffer, allowing to re-start a capture from scratch.

Link: https://lore.kernel.org/r/cover.1734093566.git.jerome.forissier@linaro.org
1  2 
include/trace.h
lib/trace.c

diff --cc include/trace.h
index 763d6d1255a94479663adea10a3eda02e085488d,782eaae2fc2218523979e67bae5e6d3501a9dfb6..2bbaed9ba12ea4b446cdf019615576cfb3ba0473
@@@ -100,6 -100,8 +100,8 @@@ void trace_set_enabled(int enabled)
  
  int trace_early_init(void);
  
 -int trace_clear(void);
++int trace_wipe(void);
  /**
   * Init the trace system
   *
diff --cc lib/trace.c
index cabbe47b58a3f5f494182e4b6145b1da311e921a,def9f912c92c6e05fc48d0d6153fa2a86517c451..1d5f7dec979e7251d11189a8dc5a84c8af628a40
@@@ -426,6 -417,34 +417,34 @@@ static int notrace trace_init_(void *bu
        return 0;
  }
  
 - * trace_clear() - clear accumulated traced data
+ /**
+  * trace_init() - initialize the tracing system and enable it
+  *
+  * @buff:     Pointer to trace buffer
+  * @buff_size:        Size of trace buffer
+  * Return:    0 if ok
+  */
+ int notrace trace_init(void *buff, size_t buff_size)
+ {
+       /* If traces are enabled already, we may have early traces to copy */
+       return trace_init_(buff, buff_size, trace_enabled, true);
+ }
+ /**
 -int notrace trace_clear(void)
++ * trace_wipe() - clear accumulated traced data
+  *
+  * May be called with tracing enabled or disabled.
+  */
++int notrace trace_wipe(void)
+ {
+       bool was_enabled = trace_enabled;
+       if (trace_enabled)
+               trace_enabled = 0;
+       return trace_init_(gd->trace_buff, CONFIG_TRACE_BUFFER_SIZE,
+                          false, was_enabled);
+ }
  #ifdef CONFIG_TRACE_EARLY
  /**
   * trace_early_init() - initialize the tracing system for early tracing