Blame view

kernel/printk/internal.h 1.98 KB
1ccea77e2   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-or-later */
42a0bb3f7   Petr Mladek   printk/nmi: gener...
2
3
  /*
   * internal.h - printk internal definitions
42a0bb3f7   Petr Mladek   printk/nmi: gener...
4
5
   */
  #include <linux/percpu.h>
099f1c84c   Sergey Senozhatsky   printk: introduce...
6
  #ifdef CONFIG_PRINTK
8c4e93c36   Petr Mladek   printk: Prepare f...
7
8
9
10
11
  #define PRINTK_SAFE_CONTEXT_MASK	0x007ffffff
  #define PRINTK_NMI_DIRECT_CONTEXT_MASK	0x008000000
  #define PRINTK_NMI_CONTEXT_MASK		0xff0000000
  
  #define PRINTK_NMI_CONTEXT_OFFSET	0x010000000
099f1c84c   Sergey Senozhatsky   printk: introduce...
12
13
  
  extern raw_spinlock_t logbuf_lock;
74caba7f2   John Ogness   printk: move dict...
14
  __printf(4, 0)
03fc7f9c9   Petr Mladek   printk/nmi: Preve...
15
  int vprintk_store(int facility, int level,
74caba7f2   John Ogness   printk: move dict...
16
  		  const struct dev_printk_info *dev_info,
03fc7f9c9   Petr Mladek   printk/nmi: Preve...
17
  		  const char *fmt, va_list args);
099f1c84c   Sergey Senozhatsky   printk: introduce...
18
  __printf(1, 0) int vprintk_default(const char *fmt, va_list args);
719f6a704   Petr Mladek   printk: Use the m...
19
  __printf(1, 0) int vprintk_deferred(const char *fmt, va_list args);
099f1c84c   Sergey Senozhatsky   printk: introduce...
20
21
22
  __printf(1, 0) int vprintk_func(const char *fmt, va_list args);
  void __printk_safe_enter(void);
  void __printk_safe_exit(void);
ab6f762f0   Sergey Senozhatsky   printk: queue wak...
23
24
  void printk_safe_init(void);
  bool printk_percpu_data_ready(void);
099f1c84c   Sergey Senozhatsky   printk: introduce...
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  #define printk_safe_enter_irqsave(flags)	\
  	do {					\
  		local_irq_save(flags);		\
  		__printk_safe_enter();		\
  	} while (0)
  
  #define printk_safe_exit_irqrestore(flags)	\
  	do {					\
  		__printk_safe_exit();		\
  		local_irq_restore(flags);	\
  	} while (0)
  
  #define printk_safe_enter_irq()		\
  	do {					\
  		local_irq_disable();		\
  		__printk_safe_enter();		\
  	} while (0)
  
  #define printk_safe_exit_irq()			\
  	do {					\
  		__printk_safe_exit();		\
  		local_irq_enable();		\
  	} while (0)
03fc7f9c9   Petr Mladek   printk/nmi: Preve...
48
  void defer_console_output(void);
099f1c84c   Sergey Senozhatsky   printk: introduce...
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  #else
  
  __printf(1, 0) int vprintk_func(const char *fmt, va_list args) { return 0; }
  
  /*
   * In !PRINTK builds we still export logbuf_lock spin_lock, console_sem
   * semaphore and some of console functions (console_unlock()/etc.), so
   * printk-safe must preserve the existing local IRQ guarantees.
   */
  #define printk_safe_enter_irqsave(flags) local_irq_save(flags)
  #define printk_safe_exit_irqrestore(flags) local_irq_restore(flags)
  
  #define printk_safe_enter_irq() local_irq_disable()
  #define printk_safe_exit_irq() local_irq_enable()
ab6f762f0   Sergey Senozhatsky   printk: queue wak...
63
64
  static inline void printk_safe_init(void) { }
  static inline bool printk_percpu_data_ready(void) { return false; }
099f1c84c   Sergey Senozhatsky   printk: introduce...
65
  #endif /* CONFIG_PRINTK */