Message ID | 1465562551-6529-2-git-send-email-abrodkin@synopsys.com |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
On Fri, Jun 10, 2016 at 03:42:30PM +0300, Alexey Brodkin wrote: > Even currently in U-Boot we don't really use kernel debug levels > we do have quite a lot of code that was copy-pasted from Linux kernel > and so contains symbols like KERN_DEBUG and alike. > > We used to just define those symbols which is fine if it is used in > constructions like: > ----------------->8-------------- > printk(KERN_DEBUG "My debug message"); > ----------------->8-------------- > > But in other places where the symbol gets passed as a separate > argument (which we also have but luckily all of them are intself > dummy stubs in U-Boot) that won't work. > > Now as a preparation to introduction of a real implementation of > print_hex_dump() we need those symbols to be defined as something real > so we're taking them as they are from Linux kernel. Contents are fine but you need to say what version of the kernel you get it from.
Hi Tom, On Fri, 2016-06-10 at 15:20 -0400, Tom Rini wrote: > On Fri, Jun 10, 2016 at 03:42:30PM +0300, Alexey Brodkin wrote: > > > > Even currently in U-Boot we don't really use kernel debug levels > > we do have quite a lot of code that was copy-pasted from Linux kernel > > and so contains symbols like KERN_DEBUG and alike. > > > > We used to just define those symbols which is fine if it is used in > > constructions like: > > ----------------->8-------------- > > printk(KERN_DEBUG "My debug message"); > > ----------------->8-------------- > > > > But in other places where the symbol gets passed as a separate > > argument (which we also have but luckily all of them are intself > > dummy stubs in U-Boot) that won't work. > > > > Now as a preparation to introduction of a real implementation of > > print_hex_dump() we need those symbols to be defined as something real > > so we're taking them as they are from Linux kernel. > > Contents are fine but you need to say what version of the kernel you get > it from. This is taken from 4.7-rc2. Given print_hex_dump() requires rework in a sense that we want to replace existing print_buffer() with it maybe we apply this patch because it has no dependencies on anything else? If you want I may resend it with added info about kernel version used for copy, or alternatively you may fixup it on patch application. -Alexey
On Mon, Jun 13, 2016 at 12:36:04PM +0000, Alexey Brodkin wrote: > Hi Tom, > > On Fri, 2016-06-10 at 15:20 -0400, Tom Rini wrote: > > On Fri, Jun 10, 2016 at 03:42:30PM +0300, Alexey Brodkin wrote: > > > > > > Even currently in U-Boot we don't really use kernel debug levels > > > we do have quite a lot of code that was copy-pasted from Linux kernel > > > and so contains symbols like KERN_DEBUG and alike. > > > > > > We used to just define those symbols which is fine if it is used in > > > constructions like: > > > ----------------->8-------------- > > > printk(KERN_DEBUG "My debug message"); > > > ----------------->8-------------- > > > > > > But in other places where the symbol gets passed as a separate > > > argument (which we also have but luckily all of them are intself > > > dummy stubs in U-Boot) that won't work. > > > > > > Now as a preparation to introduction of a real implementation of > > > print_hex_dump() we need those symbols to be defined as something real > > > so we're taking them as they are from Linux kernel. > > > > Contents are fine but you need to say what version of the kernel you get > > it from. > > This is taken from 4.7-rc2. > > Given print_hex_dump() requires rework in a sense that we want to replace > existing print_buffer() with it maybe we apply this patch because it has > no dependencies on anything else? > > If you want I may resend it with added info about kernel version used for > copy, or alternatively you may fixup it on patch application. Please just update the commit message here for the next iteration on this patch set, thanks!
diff --git a/include/linux/compat.h b/include/linux/compat.h index e561ee3..0ce7d65 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -28,14 +28,7 @@ extern struct p_current *current; #define printk printf #define printk_once printf -#define KERN_EMERG -#define KERN_ALERT -#define KERN_CRIT -#define KERN_ERR -#define KERN_WARNING -#define KERN_NOTICE -#define KERN_INFO -#define KERN_DEBUG +#include <linux/kern_levels.h> #define GFP_ATOMIC ((gfp_t) 0) #define GFP_KERNEL ((gfp_t) 0) diff --git a/include/linux/kern_levels.h b/include/linux/kern_levels.h new file mode 100644 index 0000000..c2ce155 --- /dev/null +++ b/include/linux/kern_levels.h @@ -0,0 +1,38 @@ +#ifndef __KERN_LEVELS_H__ +#define __KERN_LEVELS_H__ + +#define KERN_SOH "\001" /* ASCII Start Of Header */ +#define KERN_SOH_ASCII '\001' + +#define KERN_EMERG KERN_SOH "0" /* system is unusable */ +#define KERN_ALERT KERN_SOH "1" /* action must be taken immediately */ +#define KERN_CRIT KERN_SOH "2" /* critical conditions */ +#define KERN_ERR KERN_SOH "3" /* error conditions */ +#define KERN_WARNING KERN_SOH "4" /* warning conditions */ +#define KERN_NOTICE KERN_SOH "5" /* normal but significant condition */ +#define KERN_INFO KERN_SOH "6" /* informational */ +#define KERN_DEBUG KERN_SOH "7" /* debug-level messages */ + +#define KERN_DEFAULT KERN_SOH "d" /* the default kernel loglevel */ + +/* + * Annotation for a "continued" line of log printout (only done after a + * line that had no enclosing \n). Only to be used by core/arch code + * during early bootup (a continued line is not SMP-safe otherwise). + */ +#define KERN_CONT "" + +/* integer equivalents of KERN_<LEVEL> */ +#define LOGLEVEL_SCHED -2 /* Deferred messages from sched code + * are set to this special level */ +#define LOGLEVEL_DEFAULT -1 /* default (or last) loglevel */ +#define LOGLEVEL_EMERG 0 /* system is unusable */ +#define LOGLEVEL_ALERT 1 /* action must be taken immediately */ +#define LOGLEVEL_CRIT 2 /* critical conditions */ +#define LOGLEVEL_ERR 3 /* error conditions */ +#define LOGLEVEL_WARNING 4 /* warning conditions */ +#define LOGLEVEL_NOTICE 5 /* normal but significant condition */ +#define LOGLEVEL_INFO 6 /* informational */ +#define LOGLEVEL_DEBUG 7 /* debug-level messages */ + +#endif
Even currently in U-Boot we don't really use kernel debug levels we do have quite a lot of code that was copy-pasted from Linux kernel and so contains symbols like KERN_DEBUG and alike. We used to just define those symbols which is fine if it is used in constructions like: ----------------->8-------------- printk(KERN_DEBUG "My debug message"); ----------------->8-------------- But in other places where the symbol gets passed as a separate argument (which we also have but luckily all of them are intself dummy stubs in U-Boot) that won't work. Now as a preparation to introduction of a real implementation of print_hex_dump() we need those symbols to be defined as something real so we're taking them as they are from Linux kernel. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Stefan Roese <sr@denx.de> Cc: Tom Rini <trini@konsulko.com> --- Changes v1 -> v2: * This patch was only introduced in v2. include/linux/compat.h | 9 +-------- include/linux/kern_levels.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 include/linux/kern_levels.h