Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[safe/jmp/linux-2.6] / include / linux / kernel.h
index 7889c2f..6002ae7 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/log2.h>
 #include <linux/typecheck.h>
 #include <linux/ratelimit.h>
+#include <linux/dynamic_printk.h>
 #include <asm/byteorder.h>
 #include <asm/bug.h>
 
@@ -75,6 +76,12 @@ extern const char linux_proc_banner[];
  */
 #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
 
+/**
+ * lower_32_bits - return bits 0-31 of a number
+ * @n: the number we're accessing
+ */
+#define lower_32_bits(n) ((u32)(n))
+
 #define        KERN_EMERG      "<0>"   /* system is unusable                   */
 #define        KERN_ALERT      "<1>"   /* action must be taken immediately     */
 #define        KERN_CRIT       "<2>"   /* critical conditions                  */
@@ -102,6 +109,15 @@ struct completion;
 struct pt_regs;
 struct user;
 
+#ifdef CONFIG_PREEMPT_VOLUNTARY
+extern int _cond_resched(void);
+# define might_resched() _cond_resched()
+#else
+# define might_resched() do { } while (0)
+#endif
+
+#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
+  void __might_sleep(char *file, int line);
 /**
  * might_sleep - annotation for functions that can sleep
  *
@@ -112,15 +128,6 @@ struct user;
  * be bitten later when the calling function happens to sleep when it is not
  * supposed to.
  */
-#ifdef CONFIG_PREEMPT_VOLUNTARY
-extern int _cond_resched(void);
-# define might_resched() _cond_resched()
-#else
-# define might_resched() do { } while (0)
-#endif
-
-#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
-  void __might_sleep(char *file, int line);
 # define might_sleep() \
        do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0)
 #else
@@ -184,6 +191,30 @@ extern int kernel_text_address(unsigned long addr);
 struct pid;
 extern struct pid *session_of_pgrp(struct pid *pgrp);
 
+/*
+ * FW_BUG
+ * Add this to a message where you are sure the firmware is buggy or behaves
+ * really stupid or out of spec. Be aware that the responsible BIOS developer
+ * should be able to fix this issue or at least get a concrete idea of the
+ * problem by reading your message without the need of looking at the kernel
+ * code.
+ * 
+ * Use it for definite and high priority BIOS bugs.
+ *
+ * FW_WARN
+ * Use it for not that clear (e.g. could the kernel messed up things already?)
+ * and medium priority BIOS bugs.
+ *
+ * FW_INFO
+ * Use this one if you want to tell the user or vendor about something
+ * suspicious, but generally harmless related to the firmware.
+ *
+ * Use it for information or very low priority BIOS bugs.
+ */
+#define FW_BUG         "[Firmware Bug]: "
+#define FW_WARN                "[Firmware Warn]: "
+#define FW_INFO                "[Firmware Info]: "
+
 #ifdef CONFIG_PRINTK
 asmlinkage int vprintk(const char *fmt, va_list args)
        __attribute__ ((format (printf, 1, 0)));
@@ -207,6 +238,9 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
                { return false; }
 #endif
 
+extern int printk_needs_cpu(int cpu);
+extern void printk_tick(void);
+
 extern void asmlinkage __attribute__((format(printf, 1, 2)))
        early_printk(const char *fmt, ...);
 
@@ -229,9 +263,10 @@ extern int oops_in_progress;               /* If set, an oops, panic(), BUG() or die() is in
 extern int panic_timeout;
 extern int panic_on_oops;
 extern int panic_on_unrecovered_nmi;
-extern int tainted;
 extern const char *print_tainted(void);
-extern void add_taint(unsigned);
+extern void add_taint(unsigned flag);
+extern int test_taint(unsigned flag);
+extern unsigned long get_taint(void);
 extern int root_mountflags;
 
 /* Values used for system_state */
@@ -244,16 +279,17 @@ extern enum system_states {
        SYSTEM_SUSPEND_DISK,
 } system_state;
 
-#define TAINT_PROPRIETARY_MODULE       (1<<0)
-#define TAINT_FORCED_MODULE            (1<<1)
-#define TAINT_UNSAFE_SMP               (1<<2)
-#define TAINT_FORCED_RMMOD             (1<<3)
-#define TAINT_MACHINE_CHECK            (1<<4)
-#define TAINT_BAD_PAGE                 (1<<5)
-#define TAINT_USER                     (1<<6)
-#define TAINT_DIE                      (1<<7)
-#define TAINT_OVERRIDDEN_ACPI_TABLE    (1<<8)
-#define TAINT_WARN                     (1<<9)
+#define TAINT_PROPRIETARY_MODULE       0
+#define TAINT_FORCED_MODULE            1
+#define TAINT_UNSAFE_SMP               2
+#define TAINT_FORCED_RMMOD             3
+#define TAINT_MACHINE_CHECK            4
+#define TAINT_BAD_PAGE                 5
+#define TAINT_USER                     6
+#define TAINT_DIE                      7
+#define TAINT_OVERRIDDEN_ACPI_TABLE    8
+#define TAINT_WARN                     9
+#define TAINT_CRAP                     10
 
 extern void dump_stack(void) __cold;
 
@@ -282,28 +318,36 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
        return buf;
 }
 
-#define pr_emerg(fmt, arg...) \
-       printk(KERN_EMERG fmt, ##arg)
-#define pr_alert(fmt, arg...) \
-       printk(KERN_ALERT fmt, ##arg)
-#define pr_crit(fmt, arg...) \
-       printk(KERN_CRIT fmt, ##arg)
-#define pr_err(fmt, arg...) \
-       printk(KERN_ERR fmt, ##arg)
-#define pr_warning(fmt, arg...) \
-       printk(KERN_WARNING fmt, ##arg)
-#define pr_notice(fmt, arg...) \
-       printk(KERN_NOTICE fmt, ##arg)
-#define pr_info(fmt, arg...) \
-       printk(KERN_INFO fmt, ##arg)
-
-#ifdef DEBUG
+#ifndef pr_fmt
+#define pr_fmt(fmt) fmt
+#endif
+
+#define pr_emerg(fmt, ...) \
+        printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_alert(fmt, ...) \
+        printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_crit(fmt, ...) \
+        printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_err(fmt, ...) \
+        printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_warning(fmt, ...) \
+        printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_notice(fmt, ...) \
+        printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_info(fmt, ...) \
+        printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+
 /* If you are writing a driver, please use dev_dbg instead */
-#define pr_debug(fmt, arg...) \
-       printk(KERN_DEBUG fmt, ##arg)
+#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
+#define pr_debug(fmt, ...) do { \
+       dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
+       } while (0)
+#elif defined(DEBUG)
+#define pr_debug(fmt, ...) \
+       printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #else
-#define pr_debug(fmt, arg...) \
-       ({ if (0) printk(KERN_DEBUG fmt, ##arg); 0; })
+#define pr_debug(fmt, ...) \
+       ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
 #endif
 
 /*
@@ -317,18 +361,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
        ((unsigned char *)&addr)[3]
 #define NIPQUAD_FMT "%u.%u.%u.%u"
 
-#define NIP6(addr) \
-       ntohs((addr).s6_addr16[0]), \
-       ntohs((addr).s6_addr16[1]), \
-       ntohs((addr).s6_addr16[2]), \
-       ntohs((addr).s6_addr16[3]), \
-       ntohs((addr).s6_addr16[4]), \
-       ntohs((addr).s6_addr16[5]), \
-       ntohs((addr).s6_addr16[6]), \
-       ntohs((addr).s6_addr16[7])
-#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
-#define NIP6_SEQFMT "%04x%04x%04x%04x%04x%04x%04x%04x"
-
 #if defined(__LITTLE_ENDIAN)
 #define HIPQUAD(addr) \
        ((unsigned char *)&addr)[3], \
@@ -480,4 +512,9 @@ struct sysinfo {
 #define NUMA_BUILD 0
 #endif
 
+/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
+#ifdef CONFIG_FTRACE_MCOUNT_RECORD
+# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
+#endif
+
 #endif