History

Merge tag 'tty-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial updates from Greg KH: "Here is the large set of TTY and Serial driver patches for 5.9-rc1. Lots of bugfixes in here, thanks to syzbot fuzzing for serial and vt and console code. Other highlights include: - much needed vt/vc code cleanup from Jiri Slaby - 8250 driver fixes and additions - various serial driver updates and feature enhancements - locking cleanup for serial/console initializations - other minor cleanups All of these have been in linux-next with no reported issues" * tag 'tty-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (90 commits) MAINTAINERS: enlist Greg formally for console stuff vgacon: Fix for missing check in scrollback handling Revert "serial: 8250: Let serial core initialise spin lock" serial: 8250: Let serial core initialise spin lock tty: keyboard, do not speculate on func_table index serial: stm32: Add RS485 RTS GPIO control serial: 8250_dw: Fix common clocks usage race condition serial: 8250_dw: Pass the same rate to the clk round and set rate methods serial: 8250_dw: Simplify the ref clock rate setting procedure serial: 8250: Add 8250 port clock update method tty: serial: imx: add imx earlycon driver tty: serial: imx: enable imx serial console port as module tty/synclink: remove leftover bits of non-PCI card support tty: Use the preferred form for passing the size of a structure type tty: Fix identation issues in struct serial_struct32 tty: Avoid the use of one-element arrays serial: msm_serial: add sparse context annotation serial: pmac_zilog: add sparse context annotation newport_con: vc_color is now in state serial: imx: use hrtimers for rs485 delays ...

Linus Torvalds committed 6 years ago

Commit d6efb3a2 parents c0c419c f6c6eb263 files · +1847 −1613Browse files

Showing the changes to include/linux (5 of 63 files). Show all

Unified · Split

5 files
  1. include/linux/console.h +5 −8
  2. include/linux/console_struct.h +58 −35
  3. include/linux/serial_8250.h +2 −0
  4. include/linux/serial_core.h +1 −1
  5. include/linux/vt_kern.h +0 −3
include/linux/console.h+5−8
@@ -24,17 +24,13 @@ struct module; · 23 unmodified lines
2424 struct tty_struct;
2525 struct notifier_block;
2626
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−
3327 enum con_scroll {
3428 SM_UP,
3529 SM_DOWN,
3630 };
3731
32+enum vc_intensity;
33+
3834 /**
3935 * struct consw - callbacks for consoles
4036 *
@@ -74,8 +70,9 @@ struct consw { · 33 unmodified lines
7470 void (*con_scrolldelta)(struct vc_data *vc, int lines);
7571 int (*con_set_origin)(struct vc_data *vc);
7672 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);
73+ u8 (*con_build_attr)(struct vc_data *vc, u8 color,
74+ enum vc_intensity intensity,
75+ bool blink, bool underline, bool reverse, bool italic);
7976 void (*con_invert_region)(struct vc_data *vc, u16 *p, int count);
8077 u16 *(*con_screen_pos)(struct vc_data *vc, int offset);
8178 unsigned long (*con_getxy)(struct vc_data *vc, unsigned long position,
include/linux/console_struct.h+58−35
@@ -21,6 +21,43 @@ struct uni_pagedir; · 20 unmodified lines
2121 struct uni_screen;
2222
2323 #define NPAR 16
24+#define VC_TABSTOPS_COUNT 256U
25+
26+enum vc_intensity {
27+ VCI_HALF_BRIGHT,
28+ VCI_NORMAL,
29+ VCI_BOLD,
30+ VCI_MASK = 0x3,
31+};
32+
33+/**
34+ * struct vc_state -- state of a VC
35+ * @x: cursor's x-position
36+ * @y: cursor's y-position
37+ * @color: foreground & background colors
38+ * @Gx_charset: what's G0/G1 slot set to (like GRAF_MAP, LAT1_MAP)
39+ * @charset: what character set to use (0=G0 or 1=G1)
40+ * @intensity: see enum vc_intensity for values
41+ * @reverse: reversed foreground/background colors
42+ *
43+ * These members are defined separately from struct vc_data as we save &
44+ * restore them at times.
45+ */
46+struct vc_state {
47+ unsigned int x, y;
48+
49+ unsigned char color;
50+
51+ unsigned char Gx_charset[2];
52+ unsigned int charset : 1;
53+
54+ /* attribute flags */
55+ enum vc_intensity intensity;
56+ bool italic;
57+ bool underline;
58+ bool blink;
59+ bool reverse;
60+};
2461
2562 /*
2663 * Example: vc_data of a console that was scrolled 3 lines down.
@@ -57,6 +94,8 @@ struct uni_screen; · 30 unmodified lines
5794 struct vc_data {
5895 struct tty_port port; /* Upper level data */
5996
97+ struct vc_state state, saved_state;
98+
6099 unsigned short vc_num; /* Console number */
61100 unsigned int vc_cols; /* [#] Console size */
62101 unsigned int vc_rows;
@@ -73,8 +112,6 @@ struct vc_data { · 10 unmodified lines
73112 /* attributes for all characters on screen */
74113 unsigned char vc_attr; /* Current attributes */
75114 unsigned char vc_def_color; /* Default colors */
76− unsigned char vc_color; /* Foreground & background */
77− unsigned char vc_s_color; /* Saved foreground & background */
78115 unsigned char vc_ulcolor; /* Color for underline mode */
79116 unsigned char vc_itcolor;
80117 unsigned char vc_halfcolor; /* Color for half intensity mode */
@@ -82,8 +119,6 @@ struct vc_data { · 1 unmodified line
82119 unsigned int vc_cursor_type;
83120 unsigned short vc_complement_mask; /* [#] Xor mask for mouse pointer */
84121 unsigned short vc_s_complement_mask; /* Saved mouse pointer mask */
85− unsigned int vc_x, vc_y; /* Cursor position */
86− unsigned int vc_saved_x, vc_saved_y;
87122 unsigned long vc_pos; /* Cursor address */
88123 /* fonts */
89124 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
@@ -98,8 +133,6 @@ struct vc_data { · 8 unmodified lines
98133 int vt_newvt;
99134 wait_queue_head_t paste_wait;
100135 /* mode flags */
101− unsigned int vc_charset : 1; /* Character set G0 / G1 */
102− unsigned int vc_s_charset : 1; /* Saved character set */
103136 unsigned int vc_disp_ctrl : 1; /* Display chars < 32? */
104137 unsigned int vc_toggle_meta : 1; /* Toggle high bit? */
105138 unsigned int vc_decscnm : 1; /* Screen Mode */
@@ -107,17 +140,6 @@ struct vc_data { · 1 unmodified line
107140 unsigned int vc_decawm : 1; /* Autowrap Mode */
108141 unsigned int vc_deccm : 1; /* Cursor Visible */
109142 unsigned int vc_decim : 1; /* Insert Mode */
110− /* attribute flags */
111− unsigned int vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */
112− unsigned int vc_italic:1;
113− unsigned int vc_underline : 1;
114− unsigned int vc_blink : 1;
115− unsigned int vc_reverse : 1;
116− unsigned int vc_s_intensity : 2; /* saved rendition */
117− unsigned int vc_s_italic:1;
118− unsigned int vc_s_underline : 1;
119− unsigned int vc_s_blink : 1;
120− unsigned int vc_s_reverse : 1;
121143 /* misc */
122144 unsigned int vc_priv : 3;
123145 unsigned int vc_need_wrap : 1;
@@ -126,13 +148,9 @@ struct vc_data { · 2 unmodified lines
126148 unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */
127149 unsigned char vc_utf_count;
128150 int vc_utf_char;
129− unsigned int vc_tab_stop[8]; /* Tab stops. 256 columns. */
151+ DECLARE_BITMAP(vc_tab_stop, VC_TABSTOPS_COUNT); /* Tab stops. 256 columns. */
130152 unsigned char vc_palette[16*3]; /* Colour palette for VGA+ */
131153 unsigned short * vc_translate;
132− unsigned char vc_G0_charset;
133− unsigned char vc_G1_charset;
134− unsigned char vc_saved_G0;
135− unsigned char vc_saved_G1;
136154 unsigned int vc_resize_user; /* resize request from user */
137155 unsigned int vc_bell_pitch; /* Console bell pitch */
138156 unsigned int vc_bell_duration; /* Console bell duration */
@@ -149,24 +167,29 @@ struct vc { · 10 unmodified lines
149167 struct work_struct SAK_work;
150168
151169 /* might add scrmem, kbd at some time,
152− to have everything in one place - the disadvantage
153− would be that vc_cons etc can no longer be static */
170+ to have everything in one place */
154171 };
155172
156173 extern struct vc vc_cons [MAX_NR_CONSOLES];
157174 extern void vc_SAK(struct work_struct *work);
158175
159−#define CUR_DEF 0
160−#define CUR_NONE 1
161−#define CUR_UNDERLINE 2
162−#define CUR_LOWER_THIRD 3
163−#define CUR_LOWER_HALF 4
164−#define CUR_TWO_THIRDS 5
165−#define CUR_BLOCK 6
166−#define CUR_HWMASK 0x0f
167−#define CUR_SWMASK 0xfff0
168−
169−#define CUR_DEFAULT CUR_UNDERLINE
176+#define CUR_MAKE(size, change, set) ((size) | ((change) << 8) | \
177+ ((set) << 16))
178+#define CUR_SIZE(c) ((c) & 0x00000f)
179+# define CUR_DEF 0
180+# define CUR_NONE 1
181+# define CUR_UNDERLINE 2
182+# define CUR_LOWER_THIRD 3
183+# define CUR_LOWER_HALF 4
184+# define CUR_TWO_THIRDS 5
185+# define CUR_BLOCK 6
186+#define CUR_SW 0x000010
187+#define CUR_ALWAYS_BG 0x000020
188+#define CUR_INVERT_FG_BG 0x000040
189+#define CUR_FG 0x000700
190+#define CUR_BG 0x007000
191+#define CUR_CHANGE(c) ((c) & 0x00ff00)
192+#define CUR_SET(c) (((c) & 0xff0000) >> 8)
170193
171194 bool con_is_visible(const struct vc_data *vc);
172195
include/linux/serial_8250.h+2−0
@@ -155,6 +155,8 @@ extern int early_serial_setup(struct uart_port *port); · 154 unmodified lines
155155
156156 extern int early_serial8250_setup(struct earlycon_device *device,
157157 const char *options);
158+extern void serial8250_update_uartclk(struct uart_port *port,
159+ unsigned int uartclk);
158160 extern void serial8250_do_set_termios(struct uart_port *port,
159161 struct ktermios *termios, struct ktermios *old);
160162 extern void serial8250_do_set_ldisc(struct uart_port *port,
include/linux/serial_core.h+1−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010 #include <linux/bitops.h>
1111 #include <linux/compiler.h>
1212 #include <linux/console.h>
13−#include <linux/gpio/consumer.h>
1413 #include <linux/interrupt.h>
1514 #include <linux/circ_buf.h>
1615 #include <linux/spinlock.h>
@@ -30,6 +29,7 @@ · 13 unmodified lines
3029 struct uart_port;
3130 struct serial_struct;
3231 struct device;
32+struct gpio_desc;
3333
3434 /*
3535 * This structure describes all the operations that can be done on the
include/linux/vt_kern.h+0−3
@@ -74,8 +74,6 @@ int con_set_default_unimap(struct vc_data *vc); · 73 unmodified lines
7474 void con_free_unimap(struct vc_data *vc);
7575 int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
7676
77−#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
78− ((vc)->vc_toggle_meta ? 0x80 : 0)])
7977 #else
8078 static inline int con_set_trans_old(unsigned char __user *table)
8179 {
@@ -124,7 +122,6 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc) · 42 unmodified lines
124122 return 0;
125123 }
126124
127−#define vc_translate(vc, c) (c)
128125 #endif
129126
130127 /* vt.c */