]> Git Repo - J-u-boot.git/blobdiff - include/log.h
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-riscv into...
[J-u-boot.git] / include / log.h
index 6e84f080ef3d1e763b55e08b548585fa34f019fe..4f6d6a2c2cf8c31b372667d43e48e75ad42e5d27 100644 (file)
@@ -104,6 +104,10 @@ enum log_category_t {
        LOGC_FS,
        /** @LOGC_EXPO: Related to expo handling */
        LOGC_EXPO,
+       /** @LOGC_CONSOLE: Related to the console and stdio */
+       LOGC_CONSOLE,
+       /** @LOGC_TEST: Related to testing */
+       LOGC_TEST,
        /** @LOGC_COUNT: Number of log categories */
        LOGC_COUNT,
        /** @LOGC_END: Sentinel value for lists of log categories */
@@ -125,7 +129,7 @@ static inline int log_uc_cat(enum uclass_id id)
  * @level: Level of log record (indicating its severity)
  * @file: File name of file where log record was generated
  * @line: Line number in file where log record was generated
- * @func: Function where log record was generated
+ * @func: Function where log record was generated, NULL if not known
  * @fmt: printf() format string for log record
  * @...: Optional parameters, according to the format string @fmt
  * Return: 0 if log record was emitted, -ve on error
@@ -141,7 +145,7 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file,
  * @level: Level of log record (indicating its severity)
  * @file: File name of file where log record was generated
  * @line: Line number in file where log record was generated
- * @func: Function where log record was generated
+ * @func: Function where log record was generated, NULL if not known
  * @addr:      Starting address to display at start of line
  * @data:      pointer to data buffer
  * @width:     data value width.  May be 1, 2, or 4.
@@ -193,6 +197,12 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
 #define _LOG_DEBUG     0
 #endif
 
+#ifdef CONFIG_LOGF_FUNC
+#define _log_func      __func__
+#else
+#define _log_func      NULL
+#endif
+
 #if CONFIG_IS_ENABLED(LOG)
 
 /* Emit a log record if the level is less that the maximum */
@@ -201,7 +211,7 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
        if (_LOG_DEBUG != 0 || _l <= _LOG_MAX_LEVEL) \
                _log((enum log_category_t)(_cat), \
                     (enum log_level_t)(_l | _LOG_DEBUG), __FILE__, \
-                    __LINE__, __func__, \
+                    __LINE__, _log_func, \
                      pr_fmt(_fmt), ##_args); \
        })
 
@@ -211,7 +221,7 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
        if (_LOG_DEBUG != 0 || _l <= _LOG_MAX_LEVEL) \
                _log_buffer((enum log_category_t)(_cat), \
                            (enum log_level_t)(_l | _LOG_DEBUG), __FILE__, \
-                           __LINE__, __func__, _addr, _data, \
+                           __LINE__, _log_func, _addr, _data, \
                            _width, _count, _linelen); \
        })
 #else
@@ -238,10 +248,10 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
 #define _DEBUG 0
 #endif
 
-#ifdef CONFIG_SPL_BUILD
-#define _SPL_BUILD     1
+#ifdef CONFIG_XPL_BUILD
+#define _XPL_BUILD     1
 #else
-#define _SPL_BUILD     0
+#define _XPL_BUILD     0
 #endif
 
 #if CONFIG_IS_ENABLED(LOG)
@@ -273,9 +283,9 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
 #define debug(fmt, args...)                    \
        debug_cond(_DEBUG, fmt, ##args)
 
-/* Show a message if not in SPL */
-#define warn_non_spl(fmt, args...)                     \
-       debug_cond(!_SPL_BUILD, fmt, ##args)
+/* Show a message if not in xPL */
+#define warn_non_xpl(fmt, args...)                     \
+       debug_cond(!_XPL_BUILD, fmt, ##args)
 
 /*
  * An assertion is run-time check done in debug mode only. If DEBUG is not
@@ -314,7 +324,7 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line,
 #define assert_noisy(x) \
        ({ bool _val = (x); \
        if (!_val) \
-               __assert_fail(#x, "?", __LINE__, __func__); \
+               __assert_fail(#x, "?", __LINE__, _log_func); \
        _val; \
        })
 
@@ -688,4 +698,16 @@ static inline int log_get_default_format(void)
               (IS_ENABLED(CONFIG_LOGF_FUNC) ? BIT(LOGF_FUNC) : 0);
 }
 
+struct global_data;
+/**
+ * log_fixup_for_gd_move() - Handle global_data moving to a new place
+ *
+ * @new_gd: Pointer to the new global data
+ *
+ * The log_head list is part of global_data. Due to the way lists work, moving
+ * the list will cause it to become invalid. This function fixes that up so
+ * that the log_head list will work correctly.
+ */
+void log_fixup_for_gd_move(struct global_data *new_gd);
+
 #endif
This page took 0.029984 seconds and 4 git commands to generate.