--- zzzz-none-000/linux-3.10.107/include/linux/printk.h 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/include/linux/printk.h 2021-02-04 17:41:59.000000000 +0000 @@ -5,6 +5,7 @@ #include #include #include +#include extern const char linux_banner[]; extern const char linux_proc_banner[]; @@ -23,16 +24,25 @@ static inline const char *printk_skip_level(const char *buffer) { - if (printk_get_level(buffer)) { - switch (buffer[1]) { - case '0' ... '7': - case 'd': /* KERN_DEFAULT */ - return buffer + 2; - } - } + if (printk_get_level(buffer)) + return buffer + 2; + return buffer; } +#define CONSOLE_EXT_LOG_MAX 8192 + +/* printk's without a loglevel use this.. */ +#define MESSAGE_LOGLEVEL_DEFAULT CONFIG_MESSAGE_LOGLEVEL_DEFAULT + +/* We show everything that is MORE important than this.. */ +#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ +#define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */ +#define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */ +#define CONSOLE_LOGLEVEL_DEFAULT 7 /* anything MORE serious than KERN_DEBUG */ +#define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */ +#define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */ + extern int console_printk[]; #define console_loglevel (console_printk[0]) @@ -42,13 +52,13 @@ static inline void console_silent(void) { - console_loglevel = 0; + console_loglevel = CONSOLE_LOGLEVEL_SILENT; } static inline void console_verbose(void) { if (console_loglevel) - console_loglevel = 15; + console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH; } struct va_format { @@ -88,6 +98,13 @@ #define HW_ERR "[Hardware Error]: " /* + * DEPRECATED + * Add this to a message whenever you want to warn user space about the use + * of a deprecated aspect of an API so they can stop using it + */ +#define DEPRECATED "[Deprecated]: " + +/* * Dummy printk for disabled debugging statements to use whilst maintaining * gcc's format and side-effect checking. */ @@ -100,12 +117,13 @@ #ifdef CONFIG_EARLY_PRINTK extern asmlinkage __printf(1, 2) void early_printk(const char *fmt, ...); -void early_vprintk(const char *fmt, va_list ap); #else static inline __printf(1, 2) __cold void early_printk(const char *s, ...) { } #endif +typedef __printf(1, 0) int (*printk_func_t)(const char *fmt, va_list args); + #ifdef CONFIG_PRINTK asmlinkage __printf(5, 0) int vprintk_emit(int facility, int level, @@ -116,13 +134,24 @@ int vprintk(const char *fmt, va_list args); asmlinkage __printf(5, 6) __cold -asmlinkage int printk_emit(int facility, int level, - const char *dict, size_t dictlen, - const char *fmt, ...); +int printk_emit(int facility, int level, + const char *dict, size_t dictlen, + const char *fmt, ...); asmlinkage __printf(1, 2) __cold int printk(const char *fmt, ...); +asmlinkage __printf(1, 0) +int vprintk(const char *fmt, va_list args); + +#ifdef CONFIG_AVM_ENHANCED +asmlinkage __printf(1, 2) __cold +int printk_linux(const char *fmt, ...); + +extern void vprintk_restore(void); /* depreciated: use printk_avm_console_bend() instead */ +extern int printk_avm_console_bend(unsigned int activate); +#endif + /* * Special printk facility for scheduler/timekeeping use only, _DO_NOT_USE_ ! */ @@ -137,16 +166,20 @@ #define printk_ratelimit() __printk_ratelimit(__func__) extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, unsigned int interval_msec); - +#ifdef CONFIG_QCA_MINIDUMP +extern void get_log_buf_info(uint64_t *log_buf, uint64_t *log_buf_len); +#endif extern int printk_delay_msec; extern int dmesg_restrict; extern int kptr_restrict; extern void wake_up_klogd(void); +char *log_buf_addr_get(void); +u32 log_buf_len_get(void); void log_buf_kexec_setup(void); void __init setup_log_buf(int early); -void dump_stack_set_arch_desc(const char *fmt, ...); +__printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...); void dump_stack_print_info(const char *log_lvl); void show_regs_print_info(const char *log_lvl); #else @@ -165,6 +198,30 @@ { return 0; } +#ifdef CONFIG_AVM_ENHANCED +static inline __printf(1, 2) __cold +int printk_linux(const char *fmt __maybe_unused, ...) +{ + return 0; +} +static inline int printk_avm_console_bend(unsigned int activate __maybe_unused) { + return 0; +} +#endif + +static inline __printf(5, 0) __cold +int vprintk_emit(int facility __maybe_unused, int level __maybe_unused, + const char *dict __maybe_unused, size_t dictlen __maybe_unused, + const char *fmt __maybe_unused, va_list args __maybe_unused) +{ + return 0; +} + +static inline __printf(1, 2) __cold +int printk_sched(const char *s __maybe_unused, ...) +{ + return 0; +} static inline int printk_ratelimit(void) { return 0; @@ -179,6 +236,16 @@ { } +static inline char *log_buf_addr_get(void) +{ + return NULL; +} + +static inline u32 log_buf_len_get(void) +{ + return 0; +} + static inline void log_buf_kexec_setup(void) { } @@ -187,7 +254,7 @@ { } -static inline void dump_stack_set_arch_desc(const char *fmt, ...) +static inline __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...) { } @@ -200,12 +267,28 @@ } #endif -extern void dump_stack(void) __cold; +#ifdef CONFIG_AVM_ENHANCED +static __printf(1, 2) +int _printk(const char *fmt, ...) __attribute__((weakref("printk"))) +__attribute__((deprecated("Neuer Name 'printk()'"))); + +static __printf(1, 2) +int __printk(const char *fmt, ...) __attribute__((weakref("printk_linux"))) +__attribute__((deprecated("Neuer Name 'printk_linux()'"))); +#endif + +extern asmlinkage void dump_stack(void) __cold; #ifndef pr_fmt #define pr_fmt(fmt) fmt #endif +/* + * These can be used to print at the various log levels. + * All of these will print unconditionally, although note that pr_debug() + * and other debug macros are compiled out unless either DEBUG is defined + * or CONFIG_DYNAMIC_DEBUG is set. + */ #define pr_emerg(fmt, ...) \ printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) #define pr_alert(fmt, ...) \ @@ -221,6 +304,11 @@ printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) #define pr_info(fmt, ...) \ printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) +/* + * Like KERN_CONT, pr_cont() should only be used when continuing + * a line with no newline ('\n') enclosed. Otherwise it defaults + * back to KERN_DEFAULT. + */ #define pr_cont(fmt, ...) \ printk(KERN_CONT fmt, ##__VA_ARGS__) @@ -233,6 +321,8 @@ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif +#include + /* If you are writing a driver, please use dev_dbg instead */ #if defined(CONFIG_DYNAMIC_DEBUG) /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ @@ -251,17 +341,28 @@ */ #ifdef CONFIG_PRINTK -#define printk_once(fmt, ...) \ -({ \ - static bool __print_once; \ - \ - if (!__print_once) { \ - __print_once = true; \ - printk(fmt, ##__VA_ARGS__); \ - } \ +#define printk_once(fmt, ...) \ +({ \ + static bool __print_once __read_mostly; \ + \ + if (!__print_once) { \ + __print_once = true; \ + printk(fmt, ##__VA_ARGS__); \ + } \ +}) +#define printk_deferred_once(fmt, ...) \ +({ \ + static bool __print_once __read_mostly; \ + \ + if (!__print_once) { \ + __print_once = true; \ + printk_deferred(fmt, ##__VA_ARGS__); \ + } \ }) #else -#define printk_once(fmt, ...) \ +#define printk_once(fmt, ...) \ + no_printk(fmt, ##__VA_ARGS__) +#define printk_deferred_once(fmt, ...) \ no_printk(fmt, ##__VA_ARGS__) #endif @@ -343,7 +444,19 @@ #endif /* If you are writing a driver, please use dev_dbg instead */ -#if defined(DEBUG) +#if defined(CONFIG_DYNAMIC_DEBUG) +/* descriptor check is first to prevent flooding with "callbacks suppressed" */ +#define pr_debug_ratelimited(fmt, ...) \ +do { \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, pr_fmt(fmt)); \ + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ + __ratelimit(&_rs)) \ + __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \ +} while (0) +#elif defined(DEBUG) #define pr_debug_ratelimited(fmt, ...) \ printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else @@ -358,9 +471,9 @@ DUMP_PREFIX_ADDRESS, DUMP_PREFIX_OFFSET }; -extern void hex_dump_to_buffer(const void *buf, size_t len, - int rowsize, int groupsize, - char *linebuf, size_t linebuflen, bool ascii); +extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, + int groupsize, char *linebuf, size_t linebuflen, + bool ascii); #ifdef CONFIG_PRINTK extern void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, int rowsize, int groupsize, @@ -390,11 +503,17 @@ groupsize, buf, len, ascii) \ dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) -#else +#elif defined(DEBUG) #define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) \ print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \ groupsize, buf, len, ascii) -#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ +#else +static inline void print_hex_dump_debug(const char *prefix_str, int prefix_type, + int rowsize, int groupsize, + const void *buf, size_t len, bool ascii) +{ +} +#endif #endif