blob: a461f76fb004e874f38ec245c6a6834b333a5004 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * console_struct.h
3 *
4 * Data structure describing single virtual console except for data
5 * used by vt.c.
6 *
7 * Fields marked with [#] must be set by the low-level driver.
8 * Fields marked with [!] can be changed by the low-level driver
9 * to achieve effects such as fast scrolling by changing the origin.
10 */
11
Jon Smirla8f340e2006-07-10 04:44:12 -070012#include <linux/wait.h>
Antonino A. Daplase07dea92005-11-07 01:00:51 -080013#include <linux/vt.h>
Eric W. Biederman8b6312f2007-02-10 01:44:34 -080014#include <linux/workqueue.h>
Antonino A. Daplase07dea92005-11-07 01:00:51 -080015
Linus Torvalds1da177e2005-04-16 15:20:36 -070016struct vt_struct;
17
18#define NPAR 16
19
20struct vc_data {
21 unsigned short vc_num; /* Console number */
22 unsigned int vc_cols; /* [#] Console size */
23 unsigned int vc_rows;
24 unsigned int vc_size_row; /* Bytes per row */
25 unsigned int vc_scan_lines; /* # of scan lines */
26 unsigned long vc_origin; /* [!] Start of real screen */
27 unsigned long vc_scr_end; /* [!] End of real screen */
28 unsigned long vc_visible_origin; /* [!] Top of visible window */
29 unsigned int vc_top, vc_bottom; /* Scrolling region */
30 const struct consw *vc_sw;
31 unsigned short *vc_screenbuf; /* In-memory character/attribute buffer */
32 unsigned int vc_screenbuf_size;
33 unsigned char vc_mode; /* KD_TEXT, ... */
34 /* attributes for all characters on screen */
35 unsigned char vc_attr; /* Current attributes */
36 unsigned char vc_def_color; /* Default colors */
37 unsigned char vc_color; /* Foreground & background */
38 unsigned char vc_s_color; /* Saved foreground & background */
39 unsigned char vc_ulcolor; /* Color for underline mode */
Jan Engelhardtfa6ce9a2007-05-08 00:38:04 -070040 unsigned char vc_itcolor;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 unsigned char vc_halfcolor; /* Color for half intensity mode */
42 /* cursor */
43 unsigned int vc_cursor_type;
44 unsigned short vc_complement_mask; /* [#] Xor mask for mouse pointer */
45 unsigned short vc_s_complement_mask; /* Saved mouse pointer mask */
46 unsigned int vc_x, vc_y; /* Cursor position */
47 unsigned int vc_saved_x, vc_saved_y;
48 unsigned long vc_pos; /* Cursor address */
49 /* fonts */
50 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
51 struct console_font vc_font; /* Current VC font set */
52 unsigned short vc_video_erase_char; /* Background erase character */
53 /* VT terminal data */
54 unsigned int vc_state; /* Escape sequence parser state */
55 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
56 struct tty_struct *vc_tty; /* TTY we are attached to */
57 /* data for manual vt switching */
58 struct vt_mode vt_mode;
Eric W. Biedermanbde0d2c92006-10-02 02:17:14 -070059 struct pid *vt_pid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 int vt_newvt;
61 wait_queue_head_t paste_wait;
62 /* mode flags */
63 unsigned int vc_charset : 1; /* Character set G0 / G1 */
64 unsigned int vc_s_charset : 1; /* Saved character set */
65 unsigned int vc_disp_ctrl : 1; /* Display chars < 32? */
66 unsigned int vc_toggle_meta : 1; /* Toggle high bit? */
67 unsigned int vc_decscnm : 1; /* Screen Mode */
68 unsigned int vc_decom : 1; /* Origin Mode */
69 unsigned int vc_decawm : 1; /* Autowrap Mode */
70 unsigned int vc_deccm : 1; /* Cursor Visible */
71 unsigned int vc_decim : 1; /* Insert Mode */
72 unsigned int vc_deccolm : 1; /* 80/132 Column Mode */
73 /* attribute flags */
74 unsigned int vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */
Jan Engelhardtfa6ce9a2007-05-08 00:38:04 -070075 unsigned int vc_italic:1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 unsigned int vc_underline : 1;
77 unsigned int vc_blink : 1;
78 unsigned int vc_reverse : 1;
79 unsigned int vc_s_intensity : 2; /* saved rendition */
Jan Engelhardtfa6ce9a2007-05-08 00:38:04 -070080 unsigned int vc_s_italic:1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 unsigned int vc_s_underline : 1;
82 unsigned int vc_s_blink : 1;
83 unsigned int vc_s_reverse : 1;
84 /* misc */
85 unsigned int vc_ques : 1;
86 unsigned int vc_need_wrap : 1;
87 unsigned int vc_can_do_color : 1;
88 unsigned int vc_report_mouse : 2;
89 unsigned int vc_kmalloced : 1;
90 unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */
91 unsigned char vc_utf_count;
92 int vc_utf_char;
93 unsigned int vc_tab_stop[8]; /* Tab stops. 256 columns. */
94 unsigned char vc_palette[16*3]; /* Colour palette for VGA+ */
95 unsigned short * vc_translate;
96 unsigned char vc_G0_charset;
97 unsigned char vc_G1_charset;
98 unsigned char vc_saved_G0;
99 unsigned char vc_saved_G1;
100 unsigned int vc_bell_pitch; /* Console bell pitch */
101 unsigned int vc_bell_duration; /* Console bell duration */
102 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
103 unsigned long vc_uni_pagedir;
104 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
105 /* additional information is in vt_kern.h */
106};
107
108struct vc {
109 struct vc_data *d;
Eric W. Biederman8b6312f2007-02-10 01:44:34 -0800110 struct work_struct SAK_work;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111
112 /* might add scrmem, vt_struct, kbd at some time,
113 to have everything in one place - the disadvantage
114 would be that vc_cons etc can no longer be static */
115};
116
117extern struct vc vc_cons [MAX_NR_CONSOLES];
Eric W. Biederman8b6312f2007-02-10 01:44:34 -0800118extern void vc_SAK(struct work_struct *work);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119
120#define CUR_DEF 0
121#define CUR_NONE 1
122#define CUR_UNDERLINE 2
123#define CUR_LOWER_THIRD 3
124#define CUR_LOWER_HALF 4
125#define CUR_TWO_THIRDS 5
126#define CUR_BLOCK 6
127#define CUR_HWMASK 0x0f
128#define CUR_SWMASK 0xfff0
129
130#define CUR_DEFAULT CUR_UNDERLINE
131
132#define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)