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 12#ifndef _LINUX_CONSOLE_STRUCT_H 13#define _LINUX_CONSOLE_STRUCT_H 14 15#include <linux/wait.h> 16#include <linux/vt.h> 17#include <linux/workqueue.h> 18 19struct vt_struct; 20struct uni_pagedir; 21 22#define NPAR 16 23 24/* 25 * Example: vc_data of a console that was scrolled 3 lines down. 26 * 27 * Console buffer 28 * vc_screenbuf ---------> +----------------------+-. 29 * | initializing W | \ 30 * | initializing X | | 31 * | initializing Y | > scroll-back area 32 * | initializing Z | | 33 * | | / 34 * vc_visible_origin ---> ^+----------------------+-: 35 * (changes by scroll) || Welcome to linux | \ 36 * || | | 37 * vc_rows --->< | login: root | | visible on console 38 * || password: | > (vc_screenbuf_size is 39 * vc_origin -----------> || | | vc_size_row * vc_rows) 40 * (start when no scroll) || Last login: 12:28 | / 41 * v+----------------------+-: 42 * | Have a lot of fun... | \ 43 * vc_pos -----------------|--------v | > scroll-front area 44 * | ~ # cat_ | / 45 * vc_scr_end -----------> +----------------------+-: 46 * (vc_origin + | | \ EMPTY, to be filled by 47 * vc_screenbuf_size) | | / vc_video_erase_char 48 * +----------------------+-' 49 * <---- 2 * vc_cols -----> 50 * <---- vc_size_row -----> 51 * 52 * Note that every character in the console buffer is accompanied with an 53 * attribute in the buffer right after the character. This is not depicted 54 * in the figure. 55 */ 56struct vc_data { 57 struct tty_port port; /* Upper level data */ 58 59 unsigned short vc_num; /* Console number */ 60 unsigned int vc_cols; /* [#] Console size */ 61 unsigned int vc_rows; 62 unsigned int vc_size_row; /* Bytes per row */ 63 unsigned int vc_scan_lines; /* # of scan lines */ 64 unsigned long vc_origin; /* [!] Start of real screen */ 65 unsigned long vc_scr_end; /* [!] End of real screen */ 66 unsigned long vc_visible_origin; /* [!] Top of visible window */ 67 unsigned int vc_top, vc_bottom; /* Scrolling region */ 68 const struct consw *vc_sw; 69 unsigned short *vc_screenbuf; /* In-memory character/attribute buffer */ 70 unsigned int vc_screenbuf_size; 71 unsigned char vc_mode; /* KD_TEXT, ... */ 72 /* attributes for all characters on screen */ 73 unsigned char vc_attr; /* Current attributes */ 74 unsigned char vc_def_color; /* Default colors */ 75 unsigned char vc_color; /* Foreground & background */ 76 unsigned char vc_s_color; /* Saved foreground & background */ 77 unsigned char vc_ulcolor; /* Color for underline mode */ 78 unsigned char vc_itcolor; 79 unsigned char vc_halfcolor; /* Color for half intensity mode */ 80 /* cursor */ 81 unsigned int vc_cursor_type; 82 unsigned short vc_complement_mask; /* [#] Xor mask for mouse pointer */ 83 unsigned short vc_s_complement_mask; /* Saved mouse pointer mask */ 84 unsigned int vc_x, vc_y; /* Cursor position */ 85 unsigned int vc_saved_x, vc_saved_y; 86 unsigned long vc_pos; /* Cursor address */ 87 /* fonts */ 88 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ 89 struct console_font vc_font; /* Current VC font set */ 90 unsigned short vc_video_erase_char; /* Background erase character */ 91 /* VT terminal data */ 92 unsigned int vc_state; /* Escape sequence parser state */ 93 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 94 /* data for manual vt switching */ 95 struct vt_mode vt_mode; 96 struct pid *vt_pid; 97 int vt_newvt; 98 wait_queue_head_t paste_wait; 99 /* mode flags */ 100 unsigned int vc_charset : 1; /* Character set G0 / G1 */ 101 unsigned int vc_s_charset : 1; /* Saved character set */ 102 unsigned int vc_disp_ctrl : 1; /* Display chars < 32? */ 103 unsigned int vc_toggle_meta : 1; /* Toggle high bit? */ 104 unsigned int vc_decscnm : 1; /* Screen Mode */ 105 unsigned int vc_decom : 1; /* Origin Mode */ 106 unsigned int vc_decawm : 1; /* Autowrap Mode */ 107 unsigned int vc_deccm : 1; /* Cursor Visible */ 108 unsigned int vc_decim : 1; /* Insert Mode */ 109 /* attribute flags */ 110 unsigned int vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */ 111 unsigned int vc_italic:1; 112 unsigned int vc_underline : 1; 113 unsigned int vc_blink : 1; 114 unsigned int vc_reverse : 1; 115 unsigned int vc_s_intensity : 2; /* saved rendition */ 116 unsigned int vc_s_italic:1; 117 unsigned int vc_s_underline : 1; 118 unsigned int vc_s_blink : 1; 119 unsigned int vc_s_reverse : 1; 120 /* misc */ 121 unsigned int vc_ques : 1; 122 unsigned int vc_need_wrap : 1; 123 unsigned int vc_can_do_color : 1; 124 unsigned int vc_report_mouse : 2; 125 unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */ 126 unsigned char vc_utf_count; 127 int vc_utf_char; 128 unsigned int vc_tab_stop[8]; /* Tab stops. 256 columns. */ 129 unsigned char vc_palette[16*3]; /* Colour palette for VGA+ */ 130 unsigned short * vc_translate; 131 unsigned char vc_G0_charset; 132 unsigned char vc_G1_charset; 133 unsigned char vc_saved_G0; 134 unsigned char vc_saved_G1; 135 unsigned int vc_resize_user; /* resize request from user */ 136 unsigned int vc_bell_pitch; /* Console bell pitch */ 137 unsigned int vc_bell_duration; /* Console bell duration */ 138 unsigned short vc_cur_blink_ms; /* Cursor blink duration */ 139 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ 140 struct uni_pagedir *vc_uni_pagedir; 141 struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ 142 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */ 143 /* additional information is in vt_kern.h */ 144}; 145 146struct vc { 147 struct vc_data *d; 148 struct work_struct SAK_work; 149 150 /* might add scrmem, vt_struct, kbd at some time, 151 to have everything in one place - the disadvantage 152 would be that vc_cons etc can no longer be static */ 153}; 154 155extern struct vc vc_cons [MAX_NR_CONSOLES]; 156extern void vc_SAK(struct work_struct *work); 157 158#define CUR_DEF 0 159#define CUR_NONE 1 160#define CUR_UNDERLINE 2 161#define CUR_LOWER_THIRD 3 162#define CUR_LOWER_HALF 4 163#define CUR_TWO_THIRDS 5 164#define CUR_BLOCK 6 165#define CUR_HWMASK 0x0f 166#define CUR_SWMASK 0xfff0 167 168#define CUR_DEFAULT CUR_UNDERLINE 169 170static inline bool con_is_visible(const struct vc_data *vc) 171{ 172 return *vc->vc_display_fg == vc; 173} 174 175#endif /* _LINUX_CONSOLE_STRUCT_H */ 176