Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
Robert P. J. Day | 217397d | 2007-06-08 13:47:07 -0700 | [diff] [blame] | 12 | #ifndef _LINUX_CONSOLE_STRUCT_H |
| 13 | #define _LINUX_CONSOLE_STRUCT_H |
| 14 | |
Jon Smirl | a8f340e | 2006-07-10 04:44:12 -0700 | [diff] [blame] | 15 | #include <linux/wait.h> |
Antonino A. Daplas | e07dea9 | 2005-11-07 01:00:51 -0800 | [diff] [blame] | 16 | #include <linux/vt.h> |
Eric W. Biederman | 8b6312f | 2007-02-10 01:44:34 -0800 | [diff] [blame] | 17 | #include <linux/workqueue.h> |
Antonino A. Daplas | e07dea9 | 2005-11-07 01:00:51 -0800 | [diff] [blame] | 18 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | struct vt_struct; |
Takashi Iwai | e4bdab7 | 2014-05-13 12:09:28 +0200 | [diff] [blame] | 20 | struct uni_pagedir; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
| 22 | #define NPAR 16 |
| 23 | |
| 24 | struct vc_data { |
Alan Cox | ff917ba | 2010-06-01 22:52:55 +0200 | [diff] [blame] | 25 | struct tty_port port; /* Upper level data */ |
| 26 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | unsigned short vc_num; /* Console number */ |
| 28 | unsigned int vc_cols; /* [#] Console size */ |
| 29 | unsigned int vc_rows; |
| 30 | unsigned int vc_size_row; /* Bytes per row */ |
| 31 | unsigned int vc_scan_lines; /* # of scan lines */ |
| 32 | unsigned long vc_origin; /* [!] Start of real screen */ |
| 33 | unsigned long vc_scr_end; /* [!] End of real screen */ |
| 34 | unsigned long vc_visible_origin; /* [!] Top of visible window */ |
| 35 | unsigned int vc_top, vc_bottom; /* Scrolling region */ |
| 36 | const struct consw *vc_sw; |
| 37 | unsigned short *vc_screenbuf; /* In-memory character/attribute buffer */ |
| 38 | unsigned int vc_screenbuf_size; |
| 39 | unsigned char vc_mode; /* KD_TEXT, ... */ |
| 40 | /* attributes for all characters on screen */ |
| 41 | unsigned char vc_attr; /* Current attributes */ |
| 42 | unsigned char vc_def_color; /* Default colors */ |
| 43 | unsigned char vc_color; /* Foreground & background */ |
| 44 | unsigned char vc_s_color; /* Saved foreground & background */ |
| 45 | unsigned char vc_ulcolor; /* Color for underline mode */ |
Jan Engelhardt | fa6ce9a | 2007-05-08 00:38:04 -0700 | [diff] [blame] | 46 | unsigned char vc_itcolor; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | unsigned char vc_halfcolor; /* Color for half intensity mode */ |
| 48 | /* cursor */ |
| 49 | unsigned int vc_cursor_type; |
| 50 | unsigned short vc_complement_mask; /* [#] Xor mask for mouse pointer */ |
| 51 | unsigned short vc_s_complement_mask; /* Saved mouse pointer mask */ |
| 52 | unsigned int vc_x, vc_y; /* Cursor position */ |
| 53 | unsigned int vc_saved_x, vc_saved_y; |
| 54 | unsigned long vc_pos; /* Cursor address */ |
| 55 | /* fonts */ |
| 56 | unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ |
| 57 | struct console_font vc_font; /* Current VC font set */ |
| 58 | unsigned short vc_video_erase_char; /* Background erase character */ |
| 59 | /* VT terminal data */ |
| 60 | unsigned int vc_state; /* Escape sequence parser state */ |
| 61 | unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | /* data for manual vt switching */ |
| 63 | struct vt_mode vt_mode; |
Eric W. Biederman | bde0d2c | 2006-10-02 02:17:14 -0700 | [diff] [blame] | 64 | struct pid *vt_pid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | int vt_newvt; |
| 66 | wait_queue_head_t paste_wait; |
| 67 | /* mode flags */ |
| 68 | unsigned int vc_charset : 1; /* Character set G0 / G1 */ |
| 69 | unsigned int vc_s_charset : 1; /* Saved character set */ |
| 70 | unsigned int vc_disp_ctrl : 1; /* Display chars < 32? */ |
| 71 | unsigned int vc_toggle_meta : 1; /* Toggle high bit? */ |
| 72 | unsigned int vc_decscnm : 1; /* Screen Mode */ |
| 73 | unsigned int vc_decom : 1; /* Origin Mode */ |
| 74 | unsigned int vc_decawm : 1; /* Autowrap Mode */ |
| 75 | unsigned int vc_deccm : 1; /* Cursor Visible */ |
| 76 | unsigned int vc_decim : 1; /* Insert Mode */ |
| 77 | unsigned int vc_deccolm : 1; /* 80/132 Column Mode */ |
| 78 | /* attribute flags */ |
| 79 | unsigned int vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */ |
Jan Engelhardt | fa6ce9a | 2007-05-08 00:38:04 -0700 | [diff] [blame] | 80 | unsigned int vc_italic:1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | unsigned int vc_underline : 1; |
| 82 | unsigned int vc_blink : 1; |
| 83 | unsigned int vc_reverse : 1; |
| 84 | unsigned int vc_s_intensity : 2; /* saved rendition */ |
Jan Engelhardt | fa6ce9a | 2007-05-08 00:38:04 -0700 | [diff] [blame] | 85 | unsigned int vc_s_italic:1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | unsigned int vc_s_underline : 1; |
| 87 | unsigned int vc_s_blink : 1; |
| 88 | unsigned int vc_s_reverse : 1; |
| 89 | /* misc */ |
| 90 | unsigned int vc_ques : 1; |
| 91 | unsigned int vc_need_wrap : 1; |
| 92 | unsigned int vc_can_do_color : 1; |
| 93 | unsigned int vc_report_mouse : 2; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */ |
| 95 | unsigned char vc_utf_count; |
| 96 | int vc_utf_char; |
| 97 | unsigned int vc_tab_stop[8]; /* Tab stops. 256 columns. */ |
| 98 | unsigned char vc_palette[16*3]; /* Colour palette for VGA+ */ |
| 99 | unsigned short * vc_translate; |
| 100 | unsigned char vc_G0_charset; |
| 101 | unsigned char vc_G1_charset; |
| 102 | unsigned char vc_saved_G0; |
| 103 | unsigned char vc_saved_G1; |
Antonino A. Daplas | e400b6e | 2007-10-16 01:29:35 -0700 | [diff] [blame] | 104 | unsigned int vc_resize_user; /* resize request from user */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | unsigned int vc_bell_pitch; /* Console bell pitch */ |
| 106 | unsigned int vc_bell_duration; /* Console bell duration */ |
Scot Doyle | bd63364 | 2015-03-26 13:54:39 +0000 | [diff] [blame] | 107 | unsigned short vc_cur_blink_ms; /* Cursor blink duration */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ |
Takashi Iwai | e4bdab7 | 2014-05-13 12:09:28 +0200 | [diff] [blame] | 109 | struct uni_pagedir *vc_uni_pagedir; |
| 110 | struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ |
Jesse Barnes | 8fd4bd2 | 2010-06-23 12:56:12 -0700 | [diff] [blame] | 111 | bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | /* additional information is in vt_kern.h */ |
| 113 | }; |
| 114 | |
| 115 | struct vc { |
| 116 | struct vc_data *d; |
Eric W. Biederman | 8b6312f | 2007-02-10 01:44:34 -0800 | [diff] [blame] | 117 | struct work_struct SAK_work; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | |
| 119 | /* might add scrmem, vt_struct, kbd at some time, |
| 120 | to have everything in one place - the disadvantage |
| 121 | would be that vc_cons etc can no longer be static */ |
| 122 | }; |
| 123 | |
| 124 | extern struct vc vc_cons [MAX_NR_CONSOLES]; |
Eric W. Biederman | 8b6312f | 2007-02-10 01:44:34 -0800 | [diff] [blame] | 125 | extern void vc_SAK(struct work_struct *work); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | |
| 127 | #define CUR_DEF 0 |
| 128 | #define CUR_NONE 1 |
| 129 | #define CUR_UNDERLINE 2 |
| 130 | #define CUR_LOWER_THIRD 3 |
| 131 | #define CUR_LOWER_HALF 4 |
| 132 | #define CUR_TWO_THIRDS 5 |
| 133 | #define CUR_BLOCK 6 |
| 134 | #define CUR_HWMASK 0x0f |
| 135 | #define CUR_SWMASK 0xfff0 |
| 136 | |
| 137 | #define CUR_DEFAULT CUR_UNDERLINE |
| 138 | |
| 139 | #define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp) |
Robert P. J. Day | 217397d | 2007-06-08 13:47:07 -0700 | [diff] [blame] | 140 | |
| 141 | #endif /* _LINUX_CONSOLE_STRUCT_H */ |