hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/console.h
....@@ -16,6 +16,7 @@
1616
1717 #include <linux/atomic.h>
1818 #include <linux/types.h>
19
+#include <linux/printk.h>
1920
2021 struct vc_data;
2122 struct console_font_op;
....@@ -24,16 +25,12 @@
2425 struct tty_struct;
2526 struct notifier_block;
2627
27
-/*
28
- * this is what the terminal answers to a ESC-Z or csi0c query.
29
- */
30
-#define VT100ID "\033[?1;2c"
31
-#define VT102ID "\033[?6c"
32
-
3328 enum con_scroll {
3429 SM_UP,
3530 SM_DOWN,
3631 };
32
+
33
+enum vc_intensity;
3734
3835 /**
3936 * struct consw - callbacks for consoles
....@@ -74,10 +71,11 @@
7471 void (*con_scrolldelta)(struct vc_data *vc, int lines);
7572 int (*con_set_origin)(struct vc_data *vc);
7673 void (*con_save_screen)(struct vc_data *vc);
77
- u8 (*con_build_attr)(struct vc_data *vc, u8 color, u8 intensity,
78
- u8 blink, u8 underline, u8 reverse, u8 italic);
74
+ u8 (*con_build_attr)(struct vc_data *vc, u8 color,
75
+ enum vc_intensity intensity,
76
+ bool blink, bool underline, bool reverse, bool italic);
7977 void (*con_invert_region)(struct vc_data *vc, u16 *p, int count);
80
- u16 *(*con_screen_pos)(struct vc_data *vc, int offset);
78
+ u16 *(*con_screen_pos)(const struct vc_data *vc, int offset);
8179 unsigned long (*con_getxy)(struct vc_data *vc, unsigned long position,
8280 int *px, int *py);
8381 /*
....@@ -101,7 +99,6 @@
10199 extern const struct consw dummy_con; /* dummy console buffer */
102100 extern const struct consw vga_con; /* VGA text console */
103101 extern const struct consw newport_con; /* SGI Newport console */
104
-extern const struct consw prom_con; /* SPARC PROM console */
105102
106103 int con_is_bound(const struct consw *csw);
107104 int do_unregister_con_driver(const struct consw *csw);
....@@ -135,27 +132,32 @@
135132 */
136133
137134 #define CON_PRINTBUFFER (1)
138
-#define CON_CONSDEV (2) /* Last on the command line */
135
+#define CON_CONSDEV (2) /* Preferred console, /dev/console */
139136 #define CON_ENABLED (4)
140137 #define CON_BOOT (8)
141138 #define CON_ANYTIME (16) /* Safe to call when cpu is offline */
142139 #define CON_BRL (32) /* Used for a braille device */
143140 #define CON_EXTENDED (64) /* Use the extended output format a la /dev/kmsg */
144
-#ifdef CONFIG_PSTORE_CONSOLE_FORCE
145
-#define CON_PSTORE (128) /* Print to pstore console anyway */
146
-#endif
141
+#define CON_HANDOVER (128) /* Device was previously a boot console. */
147142
148143 struct console {
149144 char name[16];
150145 void (*write)(struct console *, const char *, unsigned);
146
+ void (*write_atomic)(struct console *co, const char *s, unsigned int count);
151147 int (*read)(struct console *, char *, unsigned);
152148 struct tty_driver *(*device)(struct console *, int *);
153149 void (*unblank)(void);
154150 int (*setup)(struct console *, char *);
151
+ int (*exit)(struct console *);
155152 int (*match)(struct console *, char *name, int idx, char *options);
156153 short flags;
157154 short index;
158155 int cflag;
156
+#ifdef CONFIG_PRINTK
157
+ char sync_buf[CONSOLE_LOG_MAX];
158
+#endif
159
+ atomic64_t printk_seq;
160
+ struct task_struct *thread;
159161 void *data;
160162 struct console *next;
161163 };
....@@ -169,6 +171,11 @@
169171 extern int console_set_on_cmdline;
170172 extern struct console *early_console;
171173
174
+enum con_flush_mode {
175
+ CONSOLE_FLUSH_PENDING,
176
+ CONSOLE_REPLAY_ALL,
177
+};
178
+
172179 extern int add_preferred_console(char *name, int idx, char *options);
173180 extern void register_console(struct console *);
174181 extern int unregister_console(struct console *);
....@@ -178,7 +185,7 @@
178185 extern void console_unlock(void);
179186 extern void console_conditional_schedule(void);
180187 extern void console_unblank(void);
181
-extern void console_flush_on_panic(void);
188
+extern void console_flush_on_panic(enum con_flush_mode mode);
182189 extern struct tty_driver *console_device(int *);
183190 extern void console_stop(struct console *);
184191 extern void console_start(struct console *);
....@@ -199,7 +206,6 @@
199206 extern void resume_console(void);
200207
201208 int mda_console_init(void);
202
-void prom_con_init(void);
203209
204210 void vcs_make_sysfs(int index);
205211 void vcs_remove_sysfs(int index);
....@@ -232,4 +238,7 @@
232238 void dummycon_register_output_notifier(struct notifier_block *nb);
233239 void dummycon_unregister_output_notifier(struct notifier_block *nb);
234240
241
+extern void console_atomic_lock(unsigned int *flags);
242
+extern void console_atomic_unlock(unsigned int flags);
243
+
235244 #endif /* _LINUX_CONSOLE_H */