Lines Matching refs:vc
137 struct vc vc_cons [MAX_NR_CONSOLES];
144 static void vc_init(struct vc_data *vc, unsigned int rows,
146 static void gotoxy(struct vc_data *vc, int new_x, int new_y);
147 static void save_cur(struct vc_data *vc);
148 static void reset_terminal(struct vc_data *vc, int do_clear);
151 static void set_cursor(struct vc_data *vc);
152 static void hide_cursor(struct vc_data *vc);
156 static void set_palette(struct vc_data *vc);
261 static void notify_write(struct vc_data *vc, unsigned int unicode) in notify_write() argument
263 struct vt_notifier_param param = { .vc = vc, .c = unicode }; in notify_write()
267 static void notify_update(struct vc_data *vc) in notify_update() argument
269 struct vt_notifier_param param = { .vc = vc }; in notify_update()
276 static inline bool con_is_fg(const struct vc_data *vc) in con_is_fg() argument
278 return vc->vc_num == fg_console; in con_is_fg()
281 static inline bool con_should_update(const struct vc_data *vc) in con_should_update() argument
283 return con_is_visible(vc) && !console_blanked; in con_should_update()
286 static inline unsigned short *screenpos(const struct vc_data *vc, int offset, in screenpos() argument
292 p = (unsigned short *)(vc->vc_origin + offset); in screenpos()
293 else if (!vc->vc_sw->con_screen_pos) in screenpos()
294 p = (unsigned short *)(vc->vc_visible_origin + offset); in screenpos()
296 p = vc->vc_sw->con_screen_pos(vc, offset); in screenpos()
321 #define get_vc_uniscr(vc) NULL argument
323 #define get_vc_uniscr(vc) vc->vc_uni_screen argument
366 static void vc_uniscr_set(struct vc_data *vc, struct uni_screen *new_uniscr) in vc_uniscr_set() argument
368 vc_uniscr_free(vc->vc_uni_screen); in vc_uniscr_set()
369 vc->vc_uni_screen = new_uniscr; in vc_uniscr_set()
372 static void vc_uniscr_putc(struct vc_data *vc, char32_t uc) in vc_uniscr_putc() argument
374 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_putc()
377 uniscr->lines[vc->state.y][vc->state.x] = uc; in vc_uniscr_putc()
380 static void vc_uniscr_insert(struct vc_data *vc, unsigned int nr) in vc_uniscr_insert() argument
382 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_insert()
385 char32_t *ln = uniscr->lines[vc->state.y]; in vc_uniscr_insert()
386 unsigned int x = vc->state.x, cols = vc->vc_cols; in vc_uniscr_insert()
393 static void vc_uniscr_delete(struct vc_data *vc, unsigned int nr) in vc_uniscr_delete() argument
395 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_delete()
398 char32_t *ln = uniscr->lines[vc->state.y]; in vc_uniscr_delete()
399 unsigned int x = vc->state.x, cols = vc->vc_cols; in vc_uniscr_delete()
406 static void vc_uniscr_clear_line(struct vc_data *vc, unsigned int x, in vc_uniscr_clear_line() argument
409 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_clear_line()
412 char32_t *ln = uniscr->lines[vc->state.y]; in vc_uniscr_clear_line()
418 static void vc_uniscr_clear_lines(struct vc_data *vc, unsigned int y, in vc_uniscr_clear_lines() argument
421 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_clear_lines()
424 unsigned int cols = vc->vc_cols; in vc_uniscr_clear_lines()
431 static void vc_uniscr_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in vc_uniscr_scroll() argument
434 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_scroll()
460 vc_uniscr_clear_lines(vc, clear, nr); in vc_uniscr_scroll()
501 int vc_uniscr_check(struct vc_data *vc) in vc_uniscr_check() argument
512 if (!vc->vc_utf) in vc_uniscr_check()
515 if (vc->vc_uni_screen) in vc_uniscr_check()
518 uniscr = vc_uniscr_alloc(vc->vc_cols, vc->vc_rows); in vc_uniscr_check()
528 p = (unsigned short *)vc->vc_origin; in vc_uniscr_check()
529 mask = vc->vc_hi_font_mask | 0xff; in vc_uniscr_check()
530 for (y = 0; y < vc->vc_rows; y++) { in vc_uniscr_check()
532 for (x = 0; x < vc->vc_cols; x++) { in vc_uniscr_check()
534 line[x] = inverse_translate(vc, glyph, true); in vc_uniscr_check()
538 vc->vc_uni_screen = uniscr; in vc_uniscr_check()
547 void vc_uniscr_copy_line(const struct vc_data *vc, void *dest, bool viewed, in vc_uniscr_copy_line() argument
550 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_copy_line()
551 int offset = row * vc->vc_size_row + col * 2; in vc_uniscr_copy_line()
556 pos = (unsigned long)screenpos(vc, offset, viewed); in vc_uniscr_copy_line()
557 if (pos >= vc->vc_origin && pos < vc->vc_scr_end) { in vc_uniscr_copy_line()
563 row = (pos - vc->vc_origin) / vc->vc_size_row; in vc_uniscr_copy_line()
564 col = ((pos - vc->vc_origin) % vc->vc_size_row) / 2; in vc_uniscr_copy_line()
574 int mask = vc->vc_hi_font_mask | 0xff; in vc_uniscr_copy_line()
578 *uni_buf++ = inverse_translate(vc, glyph, true); in vc_uniscr_copy_line()
584 static void vc_uniscr_debug_check(struct vc_data *vc) in vc_uniscr_debug_check() argument
586 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_debug_check()
599 p = (unsigned short *)vc->vc_origin; in vc_uniscr_debug_check()
600 mask = vc->vc_hi_font_mask | 0xff; in vc_uniscr_debug_check()
601 for (y = 0; y < vc->vc_rows; y++) { in vc_uniscr_debug_check()
603 for (x = 0; x < vc->vc_cols; x++) { in vc_uniscr_debug_check()
606 int tc = conv_uni_to_pc(vc, uc); in vc_uniscr_debug_check()
608 tc = conv_uni_to_pc(vc, 0xfffd); in vc_uniscr_debug_check()
610 tc = conv_uni_to_pc(vc, '?'); in vc_uniscr_debug_check()
620 static void con_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in con_scroll() argument
627 if (b > vc->vc_rows || t >= b || nr < 1) in con_scroll()
629 vc_uniscr_scroll(vc, t, b, dir, nr); in con_scroll()
630 if (con_is_visible(vc) && vc->vc_sw->con_scroll(vc, t, b, dir, nr)) in con_scroll()
633 s = clear = (u16 *)(vc->vc_origin + vc->vc_size_row * t); in con_scroll()
634 d = (u16 *)(vc->vc_origin + vc->vc_size_row * (t + nr)); in con_scroll()
637 clear = s + (b - t - nr) * vc->vc_cols; in con_scroll()
640 scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row); in con_scroll()
641 scr_memsetw(clear, vc->vc_video_erase_char, vc->vc_size_row * nr); in con_scroll()
644 static void do_update_region(struct vc_data *vc, unsigned long start, int count) in do_update_region() argument
650 if (!vc->vc_sw->con_getxy) { in do_update_region()
651 offset = (start - vc->vc_origin) / 2; in do_update_region()
652 xx = offset % vc->vc_cols; in do_update_region()
653 yy = offset / vc->vc_cols; in do_update_region()
656 start = vc->vc_sw->con_getxy(vc, start, &nxx, &nyy); in do_update_region()
663 while (xx < vc->vc_cols && count) { in do_update_region()
666 vc->vc_sw->con_putcs(vc, q, p-q, yy, startx); in do_update_region()
676 vc->vc_sw->con_putcs(vc, q, p-q, yy, startx); in do_update_region()
681 if (vc->vc_sw->con_getxy) { in do_update_region()
683 start = vc->vc_sw->con_getxy(vc, start, NULL, NULL); in do_update_region()
688 void update_region(struct vc_data *vc, unsigned long start, int count) in update_region() argument
692 if (con_should_update(vc)) { in update_region()
693 hide_cursor(vc); in update_region()
694 do_update_region(vc, start, count); in update_region()
695 set_cursor(vc); in update_region()
701 static u8 build_attr(struct vc_data *vc, u8 _color, in build_attr() argument
705 if (vc->vc_sw->con_build_attr) in build_attr()
706 return vc->vc_sw->con_build_attr(vc, _color, _intensity, in build_attr()
721 if (!vc->vc_can_do_color) in build_attr()
728 a = (a & 0xF0) | vc->vc_itcolor; in build_attr()
730 a = (a & 0xf0) | vc->vc_ulcolor; in build_attr()
732 a = (a & 0xf0) | vc->vc_halfcolor; in build_attr()
739 if (vc->vc_hi_font_mask == 0x100) in build_attr()
745 static void update_attr(struct vc_data *vc) in update_attr() argument
747 vc->vc_attr = build_attr(vc, vc->state.color, vc->state.intensity, in update_attr()
748 vc->state.blink, vc->state.underline, in update_attr()
749 vc->state.reverse ^ vc->vc_decscnm, vc->state.italic); in update_attr()
750 vc->vc_video_erase_char = ' ' | (build_attr(vc, vc->state.color, in update_attr()
751 VCI_NORMAL, vc->state.blink, false, in update_attr()
752 vc->vc_decscnm, false) << 8); in update_attr()
756 void invert_screen(struct vc_data *vc, int offset, int count, bool viewed) in invert_screen() argument
763 p = screenpos(vc, offset, viewed); in invert_screen()
764 if (vc->vc_sw->con_invert_region) { in invert_screen()
765 vc->vc_sw->con_invert_region(vc, p, count); in invert_screen()
771 if (!vc->vc_can_do_color) { in invert_screen()
778 } else if (vc->vc_hi_font_mask == 0x100) { in invert_screen()
799 if (con_should_update(vc)) in invert_screen()
800 do_update_region(vc, (unsigned long) p, count); in invert_screen()
801 notify_update(vc); in invert_screen()
805 void complement_pos(struct vc_data *vc, int offset) in complement_pos() argument
814 old_offset < vc->vc_screenbuf_size) { in complement_pos()
815 scr_writew(old, screenpos(vc, old_offset, true)); in complement_pos()
816 if (con_should_update(vc)) in complement_pos()
817 vc->vc_sw->con_putc(vc, old, oldy, oldx); in complement_pos()
818 notify_update(vc); in complement_pos()
824 offset < vc->vc_screenbuf_size) { in complement_pos()
827 p = screenpos(vc, offset, true); in complement_pos()
829 new = old ^ vc->vc_complement_mask; in complement_pos()
831 if (con_should_update(vc)) { in complement_pos()
832 oldx = (offset >> 1) % vc->vc_cols; in complement_pos()
833 oldy = (offset >> 1) / vc->vc_cols; in complement_pos()
834 vc->vc_sw->con_putc(vc, new, oldy, oldx); in complement_pos()
836 notify_update(vc); in complement_pos()
840 static void insert_char(struct vc_data *vc, unsigned int nr) in insert_char() argument
842 unsigned short *p = (unsigned short *) vc->vc_pos; in insert_char()
844 vc_uniscr_insert(vc, nr); in insert_char()
845 scr_memmovew(p + nr, p, (vc->vc_cols - vc->state.x - nr) * 2); in insert_char()
846 scr_memsetw(p, vc->vc_video_erase_char, nr * 2); in insert_char()
847 vc->vc_need_wrap = 0; in insert_char()
848 if (con_should_update(vc)) in insert_char()
849 do_update_region(vc, (unsigned long) p, in insert_char()
850 vc->vc_cols - vc->state.x); in insert_char()
853 static void delete_char(struct vc_data *vc, unsigned int nr) in delete_char() argument
855 unsigned short *p = (unsigned short *) vc->vc_pos; in delete_char()
857 vc_uniscr_delete(vc, nr); in delete_char()
858 scr_memmovew(p, p + nr, (vc->vc_cols - vc->state.x - nr) * 2); in delete_char()
859 scr_memsetw(p + vc->vc_cols - vc->state.x - nr, vc->vc_video_erase_char, in delete_char()
861 vc->vc_need_wrap = 0; in delete_char()
862 if (con_should_update(vc)) in delete_char()
863 do_update_region(vc, (unsigned long) p, in delete_char()
864 vc->vc_cols - vc->state.x); in delete_char()
869 static void add_softcursor(struct vc_data *vc) in add_softcursor() argument
871 int i = scr_readw((u16 *) vc->vc_pos); in add_softcursor()
872 u32 type = vc->vc_cursor_type; in add_softcursor()
886 scr_writew(i, (u16 *)vc->vc_pos); in add_softcursor()
887 if (con_should_update(vc)) in add_softcursor()
888 vc->vc_sw->con_putc(vc, i, vc->state.y, vc->state.x); in add_softcursor()
891 static void hide_softcursor(struct vc_data *vc) in hide_softcursor() argument
894 scr_writew(softcursor_original, (u16 *)vc->vc_pos); in hide_softcursor()
895 if (con_should_update(vc)) in hide_softcursor()
896 vc->vc_sw->con_putc(vc, softcursor_original, in hide_softcursor()
897 vc->state.y, vc->state.x); in hide_softcursor()
902 static void hide_cursor(struct vc_data *vc) in hide_cursor() argument
904 if (vc_is_sel(vc)) in hide_cursor()
907 vc->vc_sw->con_cursor(vc, CM_ERASE); in hide_cursor()
908 hide_softcursor(vc); in hide_cursor()
911 static void set_cursor(struct vc_data *vc) in set_cursor() argument
913 if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS) in set_cursor()
915 if (vc->vc_deccm) { in set_cursor()
916 if (vc_is_sel(vc)) in set_cursor()
918 add_softcursor(vc); in set_cursor()
919 if (CUR_SIZE(vc->vc_cursor_type) != CUR_NONE) in set_cursor()
920 vc->vc_sw->con_cursor(vc, CM_DRAW); in set_cursor()
922 hide_cursor(vc); in set_cursor()
925 static void set_origin(struct vc_data *vc) in set_origin() argument
929 if (!con_is_visible(vc) || in set_origin()
930 !vc->vc_sw->con_set_origin || in set_origin()
931 !vc->vc_sw->con_set_origin(vc)) in set_origin()
932 vc->vc_origin = (unsigned long)vc->vc_screenbuf; in set_origin()
933 vc->vc_visible_origin = vc->vc_origin; in set_origin()
934 vc->vc_scr_end = vc->vc_origin + vc->vc_screenbuf_size; in set_origin()
935 vc->vc_pos = vc->vc_origin + vc->vc_size_row * vc->state.y + in set_origin()
936 2 * vc->state.x; in set_origin()
939 static void save_screen(struct vc_data *vc) in save_screen() argument
943 if (vc->vc_sw->con_save_screen) in save_screen()
944 vc->vc_sw->con_save_screen(vc); in save_screen()
947 static void flush_scrollback(struct vc_data *vc) in flush_scrollback() argument
951 set_origin(vc); in flush_scrollback()
952 if (vc->vc_sw->con_flush_scrollback) { in flush_scrollback()
953 vc->vc_sw->con_flush_scrollback(vc); in flush_scrollback()
954 } else if (con_is_visible(vc)) { in flush_scrollback()
963 hide_cursor(vc); in flush_scrollback()
964 vc->vc_sw->con_switch(vc); in flush_scrollback()
965 set_cursor(vc); in flush_scrollback()
973 void clear_buffer_attributes(struct vc_data *vc) in clear_buffer_attributes() argument
975 unsigned short *p = (unsigned short *)vc->vc_origin; in clear_buffer_attributes()
976 int count = vc->vc_screenbuf_size / 2; in clear_buffer_attributes()
977 int mask = vc->vc_hi_font_mask | 0xff; in clear_buffer_attributes()
980 scr_writew((scr_readw(p)&mask) | (vc->vc_video_erase_char & ~mask), p); in clear_buffer_attributes()
984 void redraw_screen(struct vc_data *vc, int is_switch) in redraw_screen() argument
990 if (!vc) { in redraw_screen()
998 if (old_vc == vc) in redraw_screen()
1000 if (!con_is_visible(vc)) in redraw_screen()
1002 *vc->vc_display_fg = vc; in redraw_screen()
1003 fg_console = vc->vc_num; in redraw_screen()
1012 hide_cursor(vc); in redraw_screen()
1018 int old_was_color = vc->vc_can_do_color; in redraw_screen()
1020 set_origin(vc); in redraw_screen()
1021 update = vc->vc_sw->con_switch(vc); in redraw_screen()
1022 set_palette(vc); in redraw_screen()
1029 if (old_was_color != vc->vc_can_do_color) { in redraw_screen()
1030 update_attr(vc); in redraw_screen()
1031 clear_buffer_attributes(vc); in redraw_screen()
1034 if (update && vc->vc_mode != KD_GRAPHICS) in redraw_screen()
1035 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); in redraw_screen()
1037 set_cursor(vc); in redraw_screen()
1040 notify_update(vc); in redraw_screen()
1053 static void visual_init(struct vc_data *vc, int num, int init) in visual_init() argument
1056 if (vc->vc_sw) in visual_init()
1057 module_put(vc->vc_sw->owner); in visual_init()
1058 vc->vc_sw = conswitchp; in visual_init()
1061 vc->vc_sw = con_driver_map[num]; in visual_init()
1063 __module_get(vc->vc_sw->owner); in visual_init()
1064 vc->vc_num = num; in visual_init()
1065 vc->vc_display_fg = &master_display_fg; in visual_init()
1066 if (vc->vc_uni_pagedir_loc) in visual_init()
1067 con_free_unimap(vc); in visual_init()
1068 vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir; in visual_init()
1069 vc->vc_uni_pagedir = NULL; in visual_init()
1070 vc->vc_hi_font_mask = 0; in visual_init()
1071 vc->vc_complement_mask = 0; in visual_init()
1072 vc->vc_can_do_color = 0; in visual_init()
1073 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in visual_init()
1074 vc->vc_sw->con_init(vc, init); in visual_init()
1075 if (!vc->vc_complement_mask) in visual_init()
1076 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in visual_init()
1077 vc->vc_s_complement_mask = vc->vc_complement_mask; in visual_init()
1078 vc->vc_size_row = vc->vc_cols << 1; in visual_init()
1079 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; in visual_init()
1083 static void visual_deinit(struct vc_data *vc) in visual_deinit() argument
1085 vc->vc_sw->con_deinit(vc); in visual_deinit()
1086 module_put(vc->vc_sw->owner); in visual_deinit()
1091 struct vc_data *vc = container_of(port, struct vc_data, port); in vc_port_destruct() local
1093 kfree(vc); in vc_port_destruct()
1111 struct vc_data *vc; in vc_allocate() local
1128 param.vc = vc = kzalloc(sizeof(struct vc_data), GFP_KERNEL); in vc_allocate()
1129 if (!vc) in vc_allocate()
1132 vc_cons[currcons].d = vc; in vc_allocate()
1133 tty_port_init(&vc->port); in vc_allocate()
1134 vc->port.ops = &vc_port_ops; in vc_allocate()
1137 visual_init(vc, currcons, 1); in vc_allocate()
1139 if (!*vc->vc_uni_pagedir_loc) in vc_allocate()
1140 con_set_default_unimap(vc); in vc_allocate()
1143 if (vc->vc_cols > VC_MAXCOL || vc->vc_rows > VC_MAXROW || in vc_allocate()
1144 vc->vc_screenbuf_size > KMALLOC_MAX_SIZE || !vc->vc_screenbuf_size) in vc_allocate()
1147 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL); in vc_allocate()
1148 if (!vc->vc_screenbuf) in vc_allocate()
1156 vc_init(vc, vc->vc_rows, vc->vc_cols, 1); in vc_allocate()
1162 visual_deinit(vc); in vc_allocate()
1163 kfree(vc); in vc_allocate()
1168 static inline int resize_screen(struct vc_data *vc, int width, int height, in resize_screen() argument
1174 if (vc->vc_sw->con_resize) in resize_screen()
1175 err = vc->vc_sw->con_resize(vc, width, height, user); in resize_screen()
1195 static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, in vc_do_resize() argument
1208 if (!vc) in vc_do_resize()
1211 user = vc->vc_resize_user; in vc_do_resize()
1212 vc->vc_resize_user = 0; in vc_do_resize()
1217 new_cols = (cols ? cols : vc->vc_cols); in vc_do_resize()
1218 new_rows = (lines ? lines : vc->vc_rows); in vc_do_resize()
1222 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) { in vc_do_resize()
1239 return resize_screen(vc, new_cols, new_rows, user); in vc_do_resize()
1248 if (get_vc_uniscr(vc)) { in vc_do_resize()
1256 if (vc_is_sel(vc)) in vc_do_resize()
1259 old_rows = vc->vc_rows; in vc_do_resize()
1260 old_row_size = vc->vc_size_row; in vc_do_resize()
1262 err = resize_screen(vc, new_cols, new_rows, user); in vc_do_resize()
1269 vc->vc_rows = new_rows; in vc_do_resize()
1270 vc->vc_cols = new_cols; in vc_do_resize()
1271 vc->vc_size_row = new_row_size; in vc_do_resize()
1272 vc->vc_screenbuf_size = new_screen_size; in vc_do_resize()
1276 old_origin = vc->vc_origin; in vc_do_resize()
1280 if (vc->state.y > new_rows) { in vc_do_resize()
1281 if (old_rows - vc->state.y < new_rows) { in vc_do_resize()
1292 first_copied_row = (vc->state.y - new_rows/2); in vc_do_resize()
1300 get_vc_uniscr(vc), rlth/2, first_copied_row, in vc_do_resize()
1302 vc_uniscr_set(vc, new_uniscr); in vc_do_resize()
1304 update_attr(vc); in vc_do_resize()
1311 vc->vc_video_erase_char, rrem); in vc_do_resize()
1316 scr_memsetw((void *)new_origin, vc->vc_video_erase_char, in vc_do_resize()
1318 oldscreen = vc->vc_screenbuf; in vc_do_resize()
1319 vc->vc_screenbuf = newscreen; in vc_do_resize()
1320 vc->vc_screenbuf_size = new_screen_size; in vc_do_resize()
1321 set_origin(vc); in vc_do_resize()
1325 vc->vc_top = 0; in vc_do_resize()
1326 vc->vc_bottom = vc->vc_rows; in vc_do_resize()
1327 gotoxy(vc, vc->state.x, vc->state.y); in vc_do_resize()
1328 save_cur(vc); in vc_do_resize()
1335 ws.ws_row = vc->vc_rows; in vc_do_resize()
1336 ws.ws_col = vc->vc_cols; in vc_do_resize()
1337 ws.ws_ypixel = vc->vc_scan_lines; in vc_do_resize()
1341 if (con_is_visible(vc)) in vc_do_resize()
1342 update_screen(vc); in vc_do_resize()
1343 vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); in vc_do_resize()
1344 notify_update(vc); in vc_do_resize()
1360 int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows) in vc_resize() argument
1362 return vc_do_resize(vc->port.tty, vc, cols, rows); in vc_resize()
1379 struct vc_data *vc = tty->driver_data; in vt_resize() local
1383 ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row); in vt_resize()
1390 struct vc_data *vc = NULL; in vc_deallocate() local
1397 param.vc = vc = vc_cons[currcons].d; in vc_deallocate()
1400 visual_deinit(vc); in vc_deallocate()
1401 con_free_unimap(vc); in vc_deallocate()
1402 put_pid(vc->vt_pid); in vc_deallocate()
1403 vc_uniscr_set(vc, NULL); in vc_deallocate()
1404 kfree(vc->vc_screenbuf); in vc_deallocate()
1407 return vc; in vc_deallocate()
1416 #define set_kbd(vc, x) vt_set_kbd_mode_bit((vc)->vc_num, (x)) argument
1417 #define clr_kbd(vc, x) vt_clr_kbd_mode_bit((vc)->vc_num, (x)) argument
1418 #define is_kbd(vc, x) vt_get_kbd_mode_bit((vc)->vc_num, (x)) argument
1452 static void gotoxy(struct vc_data *vc, int new_x, int new_y) in gotoxy() argument
1457 vc->state.x = 0; in gotoxy()
1459 if (new_x >= vc->vc_cols) in gotoxy()
1460 vc->state.x = vc->vc_cols - 1; in gotoxy()
1462 vc->state.x = new_x; in gotoxy()
1465 if (vc->vc_decom) { in gotoxy()
1466 min_y = vc->vc_top; in gotoxy()
1467 max_y = vc->vc_bottom; in gotoxy()
1470 max_y = vc->vc_rows; in gotoxy()
1473 vc->state.y = min_y; in gotoxy()
1475 vc->state.y = max_y - 1; in gotoxy()
1477 vc->state.y = new_y; in gotoxy()
1478 vc->vc_pos = vc->vc_origin + vc->state.y * vc->vc_size_row + in gotoxy()
1479 (vc->state.x << 1); in gotoxy()
1480 vc->vc_need_wrap = 0; in gotoxy()
1484 static void gotoxay(struct vc_data *vc, int new_x, int new_y) in gotoxay() argument
1486 gotoxy(vc, new_x, vc->vc_decom ? (vc->vc_top + new_y) : new_y); in gotoxay()
1489 void scrollback(struct vc_data *vc) in scrollback() argument
1491 scrolldelta(-(vc->vc_rows / 2)); in scrollback()
1494 void scrollfront(struct vc_data *vc, int lines) in scrollfront() argument
1497 lines = vc->vc_rows / 2; in scrollfront()
1501 static void lf(struct vc_data *vc) in lf() argument
1506 if (vc->state.y + 1 == vc->vc_bottom) in lf()
1507 con_scroll(vc, vc->vc_top, vc->vc_bottom, SM_UP, 1); in lf()
1508 else if (vc->state.y < vc->vc_rows - 1) { in lf()
1509 vc->state.y++; in lf()
1510 vc->vc_pos += vc->vc_size_row; in lf()
1512 vc->vc_need_wrap = 0; in lf()
1513 notify_write(vc, '\n'); in lf()
1516 static void ri(struct vc_data *vc) in ri() argument
1521 if (vc->state.y == vc->vc_top) in ri()
1522 con_scroll(vc, vc->vc_top, vc->vc_bottom, SM_DOWN, 1); in ri()
1523 else if (vc->state.y > 0) { in ri()
1524 vc->state.y--; in ri()
1525 vc->vc_pos -= vc->vc_size_row; in ri()
1527 vc->vc_need_wrap = 0; in ri()
1530 static inline void cr(struct vc_data *vc) in cr() argument
1532 vc->vc_pos -= vc->state.x << 1; in cr()
1533 vc->vc_need_wrap = vc->state.x = 0; in cr()
1534 notify_write(vc, '\r'); in cr()
1537 static inline void bs(struct vc_data *vc) in bs() argument
1539 if (vc->state.x) { in bs()
1540 vc->vc_pos -= 2; in bs()
1541 vc->state.x--; in bs()
1542 vc->vc_need_wrap = 0; in bs()
1543 notify_write(vc, '\b'); in bs()
1547 static inline void del(struct vc_data *vc) in del() argument
1552 static void csi_J(struct vc_data *vc, int vpar) in csi_J() argument
1559 vc_uniscr_clear_line(vc, vc->state.x, in csi_J()
1560 vc->vc_cols - vc->state.x); in csi_J()
1561 vc_uniscr_clear_lines(vc, vc->state.y + 1, in csi_J()
1562 vc->vc_rows - vc->state.y - 1); in csi_J()
1563 count = (vc->vc_scr_end - vc->vc_pos) >> 1; in csi_J()
1564 start = (unsigned short *)vc->vc_pos; in csi_J()
1567 vc_uniscr_clear_line(vc, 0, vc->state.x + 1); in csi_J()
1568 vc_uniscr_clear_lines(vc, 0, vc->state.y); in csi_J()
1569 count = ((vc->vc_pos - vc->vc_origin) >> 1) + 1; in csi_J()
1570 start = (unsigned short *)vc->vc_origin; in csi_J()
1573 flush_scrollback(vc); in csi_J()
1576 vc_uniscr_clear_lines(vc, 0, vc->vc_rows); in csi_J()
1577 count = vc->vc_cols * vc->vc_rows; in csi_J()
1578 start = (unsigned short *)vc->vc_origin; in csi_J()
1583 scr_memsetw(start, vc->vc_video_erase_char, 2 * count); in csi_J()
1584 if (con_should_update(vc)) in csi_J()
1585 do_update_region(vc, (unsigned long) start, count); in csi_J()
1586 vc->vc_need_wrap = 0; in csi_J()
1589 static void csi_K(struct vc_data *vc, int vpar) in csi_K() argument
1592 unsigned short *start = (unsigned short *)vc->vc_pos; in csi_K()
1598 count = vc->vc_cols - vc->state.x; in csi_K()
1601 offset = -vc->state.x; in csi_K()
1602 count = vc->state.x + 1; in csi_K()
1605 offset = -vc->state.x; in csi_K()
1606 count = vc->vc_cols; in csi_K()
1611 vc_uniscr_clear_line(vc, vc->state.x + offset, count); in csi_K()
1612 scr_memsetw(start + offset, vc->vc_video_erase_char, 2 * count); in csi_K()
1613 vc->vc_need_wrap = 0; in csi_K()
1614 if (con_should_update(vc)) in csi_K()
1615 do_update_region(vc, (unsigned long)(start + offset), count); in csi_K()
1619 static void csi_X(struct vc_data *vc, unsigned int vpar) in csi_X() argument
1626 count = min(vpar, vc->vc_cols - vc->state.x); in csi_X()
1628 vc_uniscr_clear_line(vc, vc->state.x, count); in csi_X()
1629 scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count); in csi_X()
1630 if (con_should_update(vc)) in csi_X()
1631 vc->vc_sw->con_clear(vc, vc->state.y, vc->state.x, 1, count); in csi_X()
1632 vc->vc_need_wrap = 0; in csi_X()
1635 static void default_attr(struct vc_data *vc) in default_attr() argument
1637 vc->state.intensity = VCI_NORMAL; in default_attr()
1638 vc->state.italic = false; in default_attr()
1639 vc->state.underline = false; in default_attr()
1640 vc->state.reverse = false; in default_attr()
1641 vc->state.blink = false; in default_attr()
1642 vc->state.color = vc->vc_def_color; in default_attr()
1665 static void rgb_foreground(struct vc_data *vc, const struct rgb *c) in rgb_foreground() argument
1678 vc->state.intensity = VCI_BOLD; in rgb_foreground()
1680 vc->state.intensity = VCI_BOLD; in rgb_foreground()
1682 vc->state.intensity = VCI_NORMAL; in rgb_foreground()
1684 vc->state.color = (vc->state.color & 0xf0) | hue; in rgb_foreground()
1687 static void rgb_background(struct vc_data *vc, const struct rgb *c) in rgb_background() argument
1690 vc->state.color = (vc->state.color & 0x0f) in rgb_background()
1703 static int vc_t416_color(struct vc_data *vc, int i, in vc_t416_color() argument
1704 void(*set_color)(struct vc_data *vc, const struct rgb *c)) in vc_t416_color() argument
1709 if (i > vc->vc_npar) in vc_t416_color()
1712 if (vc->vc_par[i] == 5 && i + 1 <= vc->vc_npar) { in vc_t416_color()
1715 rgb_from_256(vc->vc_par[i], &c); in vc_t416_color()
1716 } else if (vc->vc_par[i] == 2 && i + 3 <= vc->vc_npar) { in vc_t416_color()
1718 c.r = vc->vc_par[i + 1]; in vc_t416_color()
1719 c.g = vc->vc_par[i + 2]; in vc_t416_color()
1720 c.b = vc->vc_par[i + 3]; in vc_t416_color()
1725 set_color(vc, &c); in vc_t416_color()
1731 static void csi_m(struct vc_data *vc) in csi_m() argument
1735 for (i = 0; i <= vc->vc_npar; i++) in csi_m()
1736 switch (vc->vc_par[i]) { in csi_m()
1738 default_attr(vc); in csi_m()
1741 vc->state.intensity = VCI_BOLD; in csi_m()
1744 vc->state.intensity = VCI_HALF_BRIGHT; in csi_m()
1747 vc->state.italic = true; in csi_m()
1755 vc->state.underline = true; in csi_m()
1758 vc->state.blink = true; in csi_m()
1761 vc->state.reverse = true; in csi_m()
1767 vc->vc_translate = set_translate(vc->state.Gx_charset[vc->state.charset], vc); in csi_m()
1768 vc->vc_disp_ctrl = 0; in csi_m()
1769 vc->vc_toggle_meta = 0; in csi_m()
1775 vc->vc_translate = set_translate(IBMPC_MAP, vc); in csi_m()
1776 vc->vc_disp_ctrl = 1; in csi_m()
1777 vc->vc_toggle_meta = 0; in csi_m()
1783 vc->vc_translate = set_translate(IBMPC_MAP, vc); in csi_m()
1784 vc->vc_disp_ctrl = 1; in csi_m()
1785 vc->vc_toggle_meta = 1; in csi_m()
1788 vc->state.intensity = VCI_NORMAL; in csi_m()
1791 vc->state.italic = false; in csi_m()
1794 vc->state.underline = false; in csi_m()
1797 vc->state.blink = false; in csi_m()
1800 vc->state.reverse = false; in csi_m()
1803 i = vc_t416_color(vc, i, rgb_foreground); in csi_m()
1806 i = vc_t416_color(vc, i, rgb_background); in csi_m()
1809 vc->state.color = (vc->vc_def_color & 0x0f) | in csi_m()
1810 (vc->state.color & 0xf0); in csi_m()
1813 vc->state.color = (vc->vc_def_color & 0xf0) | in csi_m()
1814 (vc->state.color & 0x0f); in csi_m()
1817 if (vc->vc_par[i] >= 90 && vc->vc_par[i] <= 107) { in csi_m()
1818 if (vc->vc_par[i] < 100) in csi_m()
1819 vc->state.intensity = VCI_BOLD; in csi_m()
1820 vc->vc_par[i] -= 60; in csi_m()
1822 if (vc->vc_par[i] >= 30 && vc->vc_par[i] <= 37) in csi_m()
1823 vc->state.color = color_table[vc->vc_par[i] - 30] in csi_m()
1824 | (vc->state.color & 0xf0); in csi_m()
1825 else if (vc->vc_par[i] >= 40 && vc->vc_par[i] <= 47) in csi_m()
1826 vc->state.color = (color_table[vc->vc_par[i] - 40] << 4) in csi_m()
1827 | (vc->state.color & 0x0f); in csi_m()
1830 update_attr(vc); in csi_m()
1839 static void cursor_report(struct vc_data *vc, struct tty_struct *tty) in cursor_report() argument
1844 len = sprintf(buf, "\033[%d;%dR", vc->state.y + in cursor_report()
1845 (vc->vc_decom ? vc->vc_top + 1 : 1), in cursor_report()
1846 vc->state.x + 1); in cursor_report()
1882 static void set_mode(struct vc_data *vc, int on_off) in set_mode() argument
1886 for (i = 0; i <= vc->vc_npar; i++) in set_mode()
1887 if (vc->vc_priv == EPdec) { in set_mode()
1888 switch(vc->vc_par[i]) { /* DEC private modes set/reset */ in set_mode()
1891 set_kbd(vc, decckm); in set_mode()
1893 clr_kbd(vc, decckm); in set_mode()
1897 vc_resize(deccolm ? 132 : 80, vc->vc_rows); in set_mode()
1903 if (vc->vc_decscnm != on_off) { in set_mode()
1904 vc->vc_decscnm = on_off; in set_mode()
1905 invert_screen(vc, 0, in set_mode()
1906 vc->vc_screenbuf_size, in set_mode()
1908 update_attr(vc); in set_mode()
1912 vc->vc_decom = on_off; in set_mode()
1913 gotoxay(vc, 0, 0); in set_mode()
1916 vc->vc_decawm = on_off; in set_mode()
1920 set_kbd(vc, decarm); in set_mode()
1922 clr_kbd(vc, decarm); in set_mode()
1925 vc->vc_report_mouse = on_off ? 1 : 0; in set_mode()
1928 vc->vc_deccm = on_off; in set_mode()
1931 vc->vc_report_mouse = on_off ? 2 : 0; in set_mode()
1935 switch(vc->vc_par[i]) { /* ANSI modes set/reset */ in set_mode()
1937 vc->vc_disp_ctrl = on_off; in set_mode()
1940 vc->vc_decim = on_off; in set_mode()
1944 set_kbd(vc, lnm); in set_mode()
1946 clr_kbd(vc, lnm); in set_mode()
1953 static void setterm_command(struct vc_data *vc) in setterm_command() argument
1955 switch (vc->vc_par[0]) { in setterm_command()
1957 if (vc->vc_can_do_color && vc->vc_par[1] < 16) { in setterm_command()
1958 vc->vc_ulcolor = color_table[vc->vc_par[1]]; in setterm_command()
1959 if (vc->state.underline) in setterm_command()
1960 update_attr(vc); in setterm_command()
1964 if (vc->vc_can_do_color && vc->vc_par[1] < 16) { in setterm_command()
1965 vc->vc_halfcolor = color_table[vc->vc_par[1]]; in setterm_command()
1966 if (vc->state.intensity == VCI_HALF_BRIGHT) in setterm_command()
1967 update_attr(vc); in setterm_command()
1971 vc->vc_def_color = vc->vc_attr; in setterm_command()
1972 if (vc->vc_hi_font_mask == 0x100) in setterm_command()
1973 vc->vc_def_color >>= 1; in setterm_command()
1974 default_attr(vc); in setterm_command()
1975 update_attr(vc); in setterm_command()
1978 blankinterval = min(vc->vc_par[1], 60U) * 60; in setterm_command()
1982 if (vc->vc_npar >= 1) in setterm_command()
1983 vc->vc_bell_pitch = vc->vc_par[1]; in setterm_command()
1985 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; in setterm_command()
1988 if (vc->vc_npar >= 1) in setterm_command()
1989 vc->vc_bell_duration = (vc->vc_par[1] < 2000) ? in setterm_command()
1990 msecs_to_jiffies(vc->vc_par[1]) : 0; in setterm_command()
1992 vc->vc_bell_duration = DEFAULT_BELL_DURATION; in setterm_command()
1995 if (vc->vc_par[1] >= 1 && vc_cons_allocated(vc->vc_par[1] - 1)) in setterm_command()
1996 set_console(vc->vc_par[1] - 1); in setterm_command()
2002 vesa_off_interval = min(vc->vc_par[1], 60U) * 60 * HZ; in setterm_command()
2008 if (vc->vc_npar >= 1 && vc->vc_par[1] >= 50 && in setterm_command()
2009 vc->vc_par[1] <= USHRT_MAX) in setterm_command()
2010 vc->vc_cur_blink_ms = vc->vc_par[1]; in setterm_command()
2012 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in setterm_command()
2018 static void csi_at(struct vc_data *vc, unsigned int nr) in csi_at() argument
2020 if (nr > vc->vc_cols - vc->state.x) in csi_at()
2021 nr = vc->vc_cols - vc->state.x; in csi_at()
2024 insert_char(vc, nr); in csi_at()
2028 static void csi_L(struct vc_data *vc, unsigned int nr) in csi_L() argument
2030 if (nr > vc->vc_rows - vc->state.y) in csi_L()
2031 nr = vc->vc_rows - vc->state.y; in csi_L()
2034 con_scroll(vc, vc->state.y, vc->vc_bottom, SM_DOWN, nr); in csi_L()
2035 vc->vc_need_wrap = 0; in csi_L()
2039 static void csi_P(struct vc_data *vc, unsigned int nr) in csi_P() argument
2041 if (nr > vc->vc_cols - vc->state.x) in csi_P()
2042 nr = vc->vc_cols - vc->state.x; in csi_P()
2045 delete_char(vc, nr); in csi_P()
2049 static void csi_M(struct vc_data *vc, unsigned int nr) in csi_M() argument
2051 if (nr > vc->vc_rows - vc->state.y) in csi_M()
2052 nr = vc->vc_rows - vc->state.y; in csi_M()
2055 con_scroll(vc, vc->state.y, vc->vc_bottom, SM_UP, nr); in csi_M()
2056 vc->vc_need_wrap = 0; in csi_M()
2060 static void save_cur(struct vc_data *vc) in save_cur() argument
2062 memcpy(&vc->saved_state, &vc->state, sizeof(vc->state)); in save_cur()
2066 static void restore_cur(struct vc_data *vc) in restore_cur() argument
2068 memcpy(&vc->state, &vc->saved_state, sizeof(vc->state)); in restore_cur()
2070 gotoxy(vc, vc->state.x, vc->state.y); in restore_cur()
2071 vc->vc_translate = set_translate(vc->state.Gx_charset[vc->state.charset], in restore_cur()
2072 vc); in restore_cur()
2073 update_attr(vc); in restore_cur()
2074 vc->vc_need_wrap = 0; in restore_cur()
2082 static void reset_terminal(struct vc_data *vc, int do_clear) in reset_terminal() argument
2086 vc->vc_top = 0; in reset_terminal()
2087 vc->vc_bottom = vc->vc_rows; in reset_terminal()
2088 vc->vc_state = ESnormal; in reset_terminal()
2089 vc->vc_priv = EPecma; in reset_terminal()
2090 vc->vc_translate = set_translate(LAT1_MAP, vc); in reset_terminal()
2091 vc->state.Gx_charset[0] = LAT1_MAP; in reset_terminal()
2092 vc->state.Gx_charset[1] = GRAF_MAP; in reset_terminal()
2093 vc->state.charset = 0; in reset_terminal()
2094 vc->vc_need_wrap = 0; in reset_terminal()
2095 vc->vc_report_mouse = 0; in reset_terminal()
2096 vc->vc_utf = default_utf8; in reset_terminal()
2097 vc->vc_utf_count = 0; in reset_terminal()
2099 vc->vc_disp_ctrl = 0; in reset_terminal()
2100 vc->vc_toggle_meta = 0; in reset_terminal()
2102 vc->vc_decscnm = 0; in reset_terminal()
2103 vc->vc_decom = 0; in reset_terminal()
2104 vc->vc_decawm = 1; in reset_terminal()
2105 vc->vc_deccm = global_cursor_default; in reset_terminal()
2106 vc->vc_decim = 0; in reset_terminal()
2108 vt_reset_keyboard(vc->vc_num); in reset_terminal()
2110 vc->vc_cursor_type = cur_default; in reset_terminal()
2111 vc->vc_complement_mask = vc->vc_s_complement_mask; in reset_terminal()
2113 default_attr(vc); in reset_terminal()
2114 update_attr(vc); in reset_terminal()
2116 bitmap_zero(vc->vc_tab_stop, VC_TABSTOPS_COUNT); in reset_terminal()
2118 set_bit(i, vc->vc_tab_stop); in reset_terminal()
2120 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; in reset_terminal()
2121 vc->vc_bell_duration = DEFAULT_BELL_DURATION; in reset_terminal()
2122 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in reset_terminal()
2124 gotoxy(vc, 0, 0); in reset_terminal()
2125 save_cur(vc); in reset_terminal()
2127 csi_J(vc, 2); in reset_terminal()
2130 static void vc_setGx(struct vc_data *vc, unsigned int which, int c) in vc_setGx() argument
2132 unsigned char *charset = &vc->state.Gx_charset[which]; in vc_setGx()
2149 if (vc->state.charset == which) in vc_setGx()
2150 vc->vc_translate = set_translate(*charset, vc); in vc_setGx()
2162 static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) in do_con_trol() argument
2168 if (ansi_control_string(vc->vc_state) && c >= 8 && c <= 13) in do_con_trol()
2174 if (ansi_control_string(vc->vc_state)) in do_con_trol()
2175 vc->vc_state = ESnormal; in do_con_trol()
2176 else if (vc->vc_bell_duration) in do_con_trol()
2177 kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration); in do_con_trol()
2180 bs(vc); in do_con_trol()
2183 vc->vc_pos -= (vc->state.x << 1); in do_con_trol()
2185 vc->state.x = find_next_bit(vc->vc_tab_stop, in do_con_trol()
2186 min(vc->vc_cols - 1, VC_TABSTOPS_COUNT), in do_con_trol()
2187 vc->state.x + 1); in do_con_trol()
2188 if (vc->state.x >= VC_TABSTOPS_COUNT) in do_con_trol()
2189 vc->state.x = vc->vc_cols - 1; in do_con_trol()
2191 vc->vc_pos += (vc->state.x << 1); in do_con_trol()
2192 notify_write(vc, '\t'); in do_con_trol()
2195 lf(vc); in do_con_trol()
2196 if (!is_kbd(vc, lnm)) in do_con_trol()
2200 cr(vc); in do_con_trol()
2203 vc->state.charset = 1; in do_con_trol()
2204 vc->vc_translate = set_translate(vc->state.Gx_charset[1], vc); in do_con_trol()
2205 vc->vc_disp_ctrl = 1; in do_con_trol()
2208 vc->state.charset = 0; in do_con_trol()
2209 vc->vc_translate = set_translate(vc->state.Gx_charset[0], vc); in do_con_trol()
2210 vc->vc_disp_ctrl = 0; in do_con_trol()
2213 vc->vc_state = ESnormal; in do_con_trol()
2216 vc->vc_state = ESesc; in do_con_trol()
2219 del(vc); in do_con_trol()
2222 vc->vc_state = ESsquare; in do_con_trol()
2225 switch(vc->vc_state) { in do_con_trol()
2227 vc->vc_state = ESnormal; in do_con_trol()
2230 vc->vc_state = ESsquare; in do_con_trol()
2233 vc->vc_state = ESnonstd; in do_con_trol()
2236 vc->vc_state = ESapc; in do_con_trol()
2239 vc->vc_state = ESpm; in do_con_trol()
2242 vc->vc_state = ESpercent; in do_con_trol()
2245 cr(vc); in do_con_trol()
2246 lf(vc); in do_con_trol()
2249 ri(vc); in do_con_trol()
2252 lf(vc); in do_con_trol()
2255 if (vc->state.x < VC_TABSTOPS_COUNT) in do_con_trol()
2256 set_bit(vc->state.x, vc->vc_tab_stop); in do_con_trol()
2259 vc->vc_state = ESdcs; in do_con_trol()
2265 save_cur(vc); in do_con_trol()
2268 restore_cur(vc); in do_con_trol()
2271 vc->vc_state = ESsetG0; in do_con_trol()
2274 vc->vc_state = ESsetG1; in do_con_trol()
2277 vc->vc_state = EShash; in do_con_trol()
2280 reset_terminal(vc, 1); in do_con_trol()
2283 clr_kbd(vc, kbdapplic); in do_con_trol()
2286 set_kbd(vc, kbdapplic); in do_con_trol()
2292 for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++) in do_con_trol()
2293 vc->vc_par[vc->vc_npar] = 0; in do_con_trol()
2294 vc->vc_npar = 0; in do_con_trol()
2295 vc->vc_state = ESpalette; in do_con_trol()
2298 reset_palette(vc); in do_con_trol()
2299 vc->vc_state = ESnormal; in do_con_trol()
2301 vc->vc_state = ESosc; in do_con_trol()
2303 vc->vc_state = ESnormal; in do_con_trol()
2307 vc->vc_par[vc->vc_npar++] = hex_to_bin(c); in do_con_trol()
2308 if (vc->vc_npar == 7) { in do_con_trol()
2309 int i = vc->vc_par[0] * 3, j = 1; in do_con_trol()
2310 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2311 vc->vc_palette[i++] += vc->vc_par[j++]; in do_con_trol()
2312 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2313 vc->vc_palette[i++] += vc->vc_par[j++]; in do_con_trol()
2314 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2315 vc->vc_palette[i] += vc->vc_par[j]; in do_con_trol()
2316 set_palette(vc); in do_con_trol()
2317 vc->vc_state = ESnormal; in do_con_trol()
2320 vc->vc_state = ESnormal; in do_con_trol()
2323 for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++) in do_con_trol()
2324 vc->vc_par[vc->vc_npar] = 0; in do_con_trol()
2325 vc->vc_npar = 0; in do_con_trol()
2326 vc->vc_state = ESgetpars; in do_con_trol()
2328 vc->vc_state=ESfunckey; in do_con_trol()
2333 vc->vc_priv = EPdec; in do_con_trol()
2336 vc->vc_priv = EPgt; in do_con_trol()
2339 vc->vc_priv = EPeq; in do_con_trol()
2342 vc->vc_priv = EPlt; in do_con_trol()
2345 vc->vc_priv = EPecma; in do_con_trol()
2348 if (c == ';' && vc->vc_npar < NPAR - 1) { in do_con_trol()
2349 vc->vc_npar++; in do_con_trol()
2352 vc->vc_par[vc->vc_npar] *= 10; in do_con_trol()
2353 vc->vc_par[vc->vc_npar] += c - '0'; in do_con_trol()
2357 vc->vc_state = EScsiignore; in do_con_trol()
2360 vc->vc_state = ESnormal; in do_con_trol()
2363 if (vc->vc_priv <= EPdec) in do_con_trol()
2364 set_mode(vc, 1); in do_con_trol()
2367 if (vc->vc_priv <= EPdec) in do_con_trol()
2368 set_mode(vc, 0); in do_con_trol()
2371 if (vc->vc_priv == EPdec) { in do_con_trol()
2372 if (vc->vc_par[0]) in do_con_trol()
2373 vc->vc_cursor_type = in do_con_trol()
2374 CUR_MAKE(vc->vc_par[0], in do_con_trol()
2375 vc->vc_par[1], in do_con_trol()
2376 vc->vc_par[2]); in do_con_trol()
2378 vc->vc_cursor_type = cur_default; in do_con_trol()
2383 if (vc->vc_priv == EPdec) { in do_con_trol()
2385 if (vc->vc_par[0]) in do_con_trol()
2386 vc->vc_complement_mask = vc->vc_par[0] << 8 | vc->vc_par[1]; in do_con_trol()
2388 vc->vc_complement_mask = vc->vc_s_complement_mask; in do_con_trol()
2393 if (vc->vc_priv == EPecma) { in do_con_trol()
2394 if (vc->vc_par[0] == 5) in do_con_trol()
2396 else if (vc->vc_par[0] == 6) in do_con_trol()
2397 cursor_report(vc, tty); in do_con_trol()
2401 if (vc->vc_priv != EPecma) { in do_con_trol()
2402 vc->vc_priv = EPecma; in do_con_trol()
2407 if (vc->vc_par[0]) in do_con_trol()
2408 vc->vc_par[0]--; in do_con_trol()
2409 gotoxy(vc, vc->vc_par[0], vc->state.y); in do_con_trol()
2412 if (!vc->vc_par[0]) in do_con_trol()
2413 vc->vc_par[0]++; in do_con_trol()
2414 gotoxy(vc, vc->state.x, vc->state.y - vc->vc_par[0]); in do_con_trol()
2417 if (!vc->vc_par[0]) in do_con_trol()
2418 vc->vc_par[0]++; in do_con_trol()
2419 gotoxy(vc, vc->state.x, vc->state.y + vc->vc_par[0]); in do_con_trol()
2422 if (!vc->vc_par[0]) in do_con_trol()
2423 vc->vc_par[0]++; in do_con_trol()
2424 gotoxy(vc, vc->state.x + vc->vc_par[0], vc->state.y); in do_con_trol()
2427 if (!vc->vc_par[0]) in do_con_trol()
2428 vc->vc_par[0]++; in do_con_trol()
2429 gotoxy(vc, vc->state.x - vc->vc_par[0], vc->state.y); in do_con_trol()
2432 if (!vc->vc_par[0]) in do_con_trol()
2433 vc->vc_par[0]++; in do_con_trol()
2434 gotoxy(vc, 0, vc->state.y + vc->vc_par[0]); in do_con_trol()
2437 if (!vc->vc_par[0]) in do_con_trol()
2438 vc->vc_par[0]++; in do_con_trol()
2439 gotoxy(vc, 0, vc->state.y - vc->vc_par[0]); in do_con_trol()
2442 if (vc->vc_par[0]) in do_con_trol()
2443 vc->vc_par[0]--; in do_con_trol()
2444 gotoxay(vc, vc->state.x ,vc->vc_par[0]); in do_con_trol()
2447 if (vc->vc_par[0]) in do_con_trol()
2448 vc->vc_par[0]--; in do_con_trol()
2449 if (vc->vc_par[1]) in do_con_trol()
2450 vc->vc_par[1]--; in do_con_trol()
2451 gotoxay(vc, vc->vc_par[1], vc->vc_par[0]); in do_con_trol()
2454 csi_J(vc, vc->vc_par[0]); in do_con_trol()
2457 csi_K(vc, vc->vc_par[0]); in do_con_trol()
2460 csi_L(vc, vc->vc_par[0]); in do_con_trol()
2463 csi_M(vc, vc->vc_par[0]); in do_con_trol()
2466 csi_P(vc, vc->vc_par[0]); in do_con_trol()
2469 if (!vc->vc_par[0]) in do_con_trol()
2473 if (!vc->vc_par[0] && vc->state.x < VC_TABSTOPS_COUNT) in do_con_trol()
2474 set_bit(vc->state.x, vc->vc_tab_stop); in do_con_trol()
2475 else if (vc->vc_par[0] == 3) in do_con_trol()
2476 bitmap_zero(vc->vc_tab_stop, VC_TABSTOPS_COUNT); in do_con_trol()
2479 csi_m(vc); in do_con_trol()
2483 if (vc->vc_par[0] < 4) in do_con_trol()
2484 vt_set_led_state(vc->vc_num, in do_con_trol()
2485 (vc->vc_par[0] < 3) ? vc->vc_par[0] : 4); in do_con_trol()
2488 if (!vc->vc_par[0]) in do_con_trol()
2489 vc->vc_par[0]++; in do_con_trol()
2490 if (!vc->vc_par[1]) in do_con_trol()
2491 vc->vc_par[1] = vc->vc_rows; in do_con_trol()
2493 if (vc->vc_par[0] < vc->vc_par[1] && in do_con_trol()
2494 vc->vc_par[1] <= vc->vc_rows) { in do_con_trol()
2495 vc->vc_top = vc->vc_par[0] - 1; in do_con_trol()
2496 vc->vc_bottom = vc->vc_par[1]; in do_con_trol()
2497 gotoxay(vc, 0, 0); in do_con_trol()
2501 save_cur(vc); in do_con_trol()
2504 restore_cur(vc); in do_con_trol()
2507 csi_X(vc, vc->vc_par[0]); in do_con_trol()
2510 csi_at(vc, vc->vc_par[0]); in do_con_trol()
2513 setterm_command(vc); in do_con_trol()
2520 vc->vc_state = ESnormal; in do_con_trol()
2523 vc->vc_state = ESnormal; in do_con_trol()
2526 vc->vc_utf = 0; in do_con_trol()
2530 vc->vc_utf = 1; in do_con_trol()
2535 vc->vc_state = ESnormal; in do_con_trol()
2538 vc->vc_state = ESnormal; in do_con_trol()
2541 vc->vc_video_erase_char = in do_con_trol()
2542 (vc->vc_video_erase_char & 0xff00) | 'E'; in do_con_trol()
2543 csi_J(vc, 2); in do_con_trol()
2544 vc->vc_video_erase_char = in do_con_trol()
2545 (vc->vc_video_erase_char & 0xff00) | ' '; in do_con_trol()
2546 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); in do_con_trol()
2550 vc_setGx(vc, 0, c); in do_con_trol()
2551 vc->vc_state = ESnormal; in do_con_trol()
2554 vc_setGx(vc, 1, c); in do_con_trol()
2555 vc->vc_state = ESnormal; in do_con_trol()
2566 vc->vc_state = ESnormal; in do_con_trol()
2612 static void con_flush(struct vc_data *vc, struct vc_draw_region *draw) in con_flush() argument
2617 vc->vc_sw->con_putcs(vc, (u16 *)draw->from, in con_flush()
2618 (u16 *)draw->to - (u16 *)draw->from, vc->state.y, in con_flush()
2623 static inline int vc_translate_ascii(const struct vc_data *vc, int c) in vc_translate_ascii() argument
2626 if (vc->vc_toggle_meta) in vc_translate_ascii()
2629 return vc->vc_translate[c]; in vc_translate_ascii()
2658 static int vc_translate_unicode(struct vc_data *vc, int c, bool *rescan) in vc_translate_unicode() argument
2668 if (!vc->vc_utf_count) in vc_translate_unicode()
2671 vc->vc_utf_char = (vc->vc_utf_char << 6) | (c & 0x3f); in vc_translate_unicode()
2672 vc->vc_npar++; in vc_translate_unicode()
2673 if (--vc->vc_utf_count) in vc_translate_unicode()
2677 c = vc->vc_utf_char; in vc_translate_unicode()
2679 if (c <= utf8_length_changes[vc->vc_npar - 1] || in vc_translate_unicode()
2680 c > utf8_length_changes[vc->vc_npar]) in vc_translate_unicode()
2687 if (vc->vc_utf_count) { in vc_translate_unicode()
2690 vc->vc_utf_count = 0; in vc_translate_unicode()
2699 vc->vc_npar = 0; in vc_translate_unicode()
2701 vc->vc_utf_count = 1; in vc_translate_unicode()
2702 vc->vc_utf_char = (c & 0x1f); in vc_translate_unicode()
2704 vc->vc_utf_count = 2; in vc_translate_unicode()
2705 vc->vc_utf_char = (c & 0x0f); in vc_translate_unicode()
2707 vc->vc_utf_count = 3; in vc_translate_unicode()
2708 vc->vc_utf_char = (c & 0x07); in vc_translate_unicode()
2710 vc->vc_utf_count = 4; in vc_translate_unicode()
2711 vc->vc_utf_char = (c & 0x03); in vc_translate_unicode()
2713 vc->vc_utf_count = 5; in vc_translate_unicode()
2714 vc->vc_utf_char = (c & 0x01); in vc_translate_unicode()
2724 static int vc_translate(struct vc_data *vc, int *c, bool *rescan) in vc_translate() argument
2727 if (vc->vc_state != ESnormal) in vc_translate()
2730 if (vc->vc_utf && !vc->vc_disp_ctrl) in vc_translate()
2731 return *c = vc_translate_unicode(vc, *c, rescan); in vc_translate()
2734 return vc_translate_ascii(vc, *c); in vc_translate()
2737 static inline unsigned char vc_invert_attr(const struct vc_data *vc) in vc_invert_attr() argument
2739 if (!vc->vc_can_do_color) in vc_invert_attr()
2740 return vc->vc_attr ^ 0x08; in vc_invert_attr()
2742 if (vc->vc_hi_font_mask == 0x100) in vc_invert_attr()
2743 return (vc->vc_attr & 0x11) | in vc_invert_attr()
2744 ((vc->vc_attr & 0xe0) >> 4) | in vc_invert_attr()
2745 ((vc->vc_attr & 0x0e) << 4); in vc_invert_attr()
2747 return (vc->vc_attr & 0x88) | in vc_invert_attr()
2748 ((vc->vc_attr & 0x70) >> 4) | in vc_invert_attr()
2749 ((vc->vc_attr & 0x07) << 4); in vc_invert_attr()
2752 static bool vc_is_control(struct vc_data *vc, int tc, int c) in vc_is_control() argument
2764 if (vc->vc_state != ESnormal) in vc_is_control()
2780 if (vc->vc_disp_ctrl) in vc_is_control()
2783 return vc->vc_utf || (CTRL_ACTION & BIT(c)); in vc_is_control()
2786 if (c == 127 && !vc->vc_disp_ctrl) in vc_is_control()
2795 static int vc_con_write_normal(struct vc_data *vc, int tc, int c, in vc_con_write_normal() argument
2799 unsigned char vc_attr = vc->vc_attr; in vc_con_write_normal()
2800 u16 himask = vc->vc_hi_font_mask, charmask = himask ? 0x1ff : 0xff; in vc_con_write_normal()
2804 if (vc->vc_utf && !vc->vc_disp_ctrl) { in vc_con_write_normal()
2810 tc = conv_uni_to_pc(vc, tc); in vc_con_write_normal()
2816 if ((!vc->vc_utf || vc->vc_disp_ctrl || c < 128) && in vc_con_write_normal()
2832 tc = conv_uni_to_pc(vc, 0xfffd); in vc_con_write_normal()
2835 tc = conv_uni_to_pc(vc, '?'); in vc_con_write_normal()
2839 vc_attr = vc_invert_attr(vc); in vc_con_write_normal()
2840 con_flush(vc, draw); in vc_con_write_normal()
2847 if (vc->vc_need_wrap || vc->vc_decim) in vc_con_write_normal()
2848 con_flush(vc, draw); in vc_con_write_normal()
2849 if (vc->vc_need_wrap) { in vc_con_write_normal()
2850 cr(vc); in vc_con_write_normal()
2851 lf(vc); in vc_con_write_normal()
2853 if (vc->vc_decim) in vc_con_write_normal()
2854 insert_char(vc, 1); in vc_con_write_normal()
2855 vc_uniscr_putc(vc, next_c); in vc_con_write_normal()
2862 scr_writew(tc, (u16 *)vc->vc_pos); in vc_con_write_normal()
2864 if (con_should_update(vc) && draw->x < 0) { in vc_con_write_normal()
2865 draw->x = vc->state.x; in vc_con_write_normal()
2866 draw->from = vc->vc_pos; in vc_con_write_normal()
2868 if (vc->state.x == vc->vc_cols - 1) { in vc_con_write_normal()
2869 vc->vc_need_wrap = vc->vc_decawm; in vc_con_write_normal()
2870 draw->to = vc->vc_pos + 2; in vc_con_write_normal()
2872 vc->state.x++; in vc_con_write_normal()
2873 draw->to = (vc->vc_pos += 2); in vc_con_write_normal()
2880 tc = conv_uni_to_pc(vc, ' '); in vc_con_write_normal()
2885 notify_write(vc, c); in vc_con_write_normal()
2888 con_flush(vc, draw); in vc_con_write_normal()
2901 struct vc_data *vc; in do_con_write() local
2909 vc = tty->driver_data; in do_con_write()
2910 if (vc == NULL) { in do_con_write()
2916 currcons = vc->vc_num; in do_con_write()
2926 if (con_is_fg(vc)) in do_con_write()
2927 hide_cursor(vc); in do_con_write()
2929 param.vc = vc; in do_con_write()
2940 tc = vc_translate(vc, &c, &rescan); in do_con_write()
2949 if (vc_is_control(vc, tc, c)) { in do_con_write()
2950 con_flush(vc, &draw); in do_con_write()
2951 do_con_trol(tty, vc, orig); in do_con_write()
2955 if (vc_con_write_normal(vc, tc, c, &draw) < 0) in do_con_write()
2961 con_flush(vc, &draw); in do_con_write()
2962 vc_uniscr_debug_check(vc); in do_con_write()
2964 notify_update(vc); in do_con_write()
2998 struct vc_data *vc = vc_cons[fg_console].d; in console_callback() local
3000 if (vc->vc_mode == KD_TEXT && vc->vc_sw->con_scrolldelta) in console_callback()
3001 vc->vc_sw->con_scrolldelta(vc, scrollback_delta); in console_callback()
3015 struct vc_data *vc = vc_cons[fg_console].d; in set_console() local
3018 (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) { in set_console()
3080 struct vc_data *vc = vc_cons[fg_console].d; in vt_console_print() local
3095 vc = vc_cons[kmsg_console - 1].d; in vt_console_print()
3103 if (vc->vc_mode != KD_TEXT) in vt_console_print()
3107 if (con_is_fg(vc)) in vt_console_print()
3108 hide_cursor(vc); in vt_console_print()
3110 start = (ushort *)vc->vc_pos; in vt_console_print()
3111 start_x = vc->state.x; in vt_console_print()
3115 if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { in vt_console_print()
3116 if (cnt && con_is_visible(vc)) in vt_console_print()
3117 vc->vc_sw->con_putcs(vc, start, cnt, vc->state.y, start_x); in vt_console_print()
3120 bs(vc); in vt_console_print()
3121 start = (ushort *)vc->vc_pos; in vt_console_print()
3122 start_x = vc->state.x; in vt_console_print()
3126 lf(vc); in vt_console_print()
3127 cr(vc); in vt_console_print()
3128 start = (ushort *)vc->vc_pos; in vt_console_print()
3129 start_x = vc->state.x; in vt_console_print()
3133 vc_uniscr_putc(vc, c); in vt_console_print()
3134 scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); in vt_console_print()
3135 notify_write(vc, c); in vt_console_print()
3137 if (vc->state.x == vc->vc_cols - 1) { in vt_console_print()
3138 vc->vc_need_wrap = 1; in vt_console_print()
3140 vc->vc_pos += 2; in vt_console_print()
3141 vc->state.x++; in vt_console_print()
3144 if (cnt && con_is_visible(vc)) in vt_console_print()
3145 vc->vc_sw->con_putcs(vc, start, cnt, vc->state.y, start_x); in vt_console_print()
3146 set_cursor(vc); in vt_console_print()
3147 notify_update(vc); in vt_console_print()
3324 struct vc_data *vc = tty->driver_data; in con_unthrottle() local
3326 wake_up_interruptible(&vc->paste_wait); in con_unthrottle()
3359 struct vc_data *vc; in con_flush_chars() local
3366 vc = tty->driver_data; in con_flush_chars()
3367 if (vc) in con_flush_chars()
3368 set_cursor(vc); in con_flush_chars()
3378 struct vc_data *vc; in con_install() local
3386 vc = vc_cons[currcons].d; in con_install()
3389 if (vc->port.tty) { in con_install()
3394 ret = tty_port_install(&vc->port, driver, tty); in con_install()
3398 tty->driver_data = vc; in con_install()
3399 vc->port.tty = tty; in con_install()
3400 tty_port_get(&vc->port); in con_install()
3406 if (vc->vc_utf) in con_install()
3429 struct vc_data *vc = tty->driver_data; in con_shutdown() local
3430 BUG_ON(vc == NULL); in con_shutdown()
3432 vc->port.tty = NULL; in con_shutdown()
3438 struct vc_data *vc = tty->driver_data; in con_cleanup() local
3440 tty_port_put(&vc->port); in con_cleanup()
3450 static void vc_init(struct vc_data *vc, unsigned int rows, in vc_init() argument
3455 vc->vc_cols = cols; in vc_init()
3456 vc->vc_rows = rows; in vc_init()
3457 vc->vc_size_row = cols << 1; in vc_init()
3458 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; in vc_init()
3460 set_origin(vc); in vc_init()
3461 vc->vc_pos = vc->vc_origin; in vc_init()
3462 reset_vc(vc); in vc_init()
3464 vc->vc_palette[k++] = default_red[j] ; in vc_init()
3465 vc->vc_palette[k++] = default_grn[j] ; in vc_init()
3466 vc->vc_palette[k++] = default_blu[j] ; in vc_init()
3468 vc->vc_def_color = default_color; in vc_init()
3469 vc->vc_ulcolor = default_underline_color; in vc_init()
3470 vc->vc_itcolor = default_italic_color; in vc_init()
3471 vc->vc_halfcolor = 0x08; /* grey */ in vc_init()
3472 init_waitqueue_head(&vc->paste_wait); in vc_init()
3473 reset_terminal(vc, do_clear); in vc_init()
3485 struct vc_data *vc; in con_init() local
3521 vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT); in con_init()
3523 tty_port_init(&vc->port); in con_init()
3524 visual_init(vc, currcons, 1); in con_init()
3526 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); in con_init()
3527 vc_init(vc, vc->vc_rows, vc->vc_cols, in con_init()
3528 currcons || !vc->vc_sw->con_save_screen); in con_init()
3531 master_display_fg = vc = vc_cons[currcons].d; in con_init()
3532 set_origin(vc); in con_init()
3533 save_screen(vc); in con_init()
3534 gotoxy(vc, vc->state.x, vc->state.y); in con_init()
3535 csi_J(vc, 0); in con_init()
3536 update_screen(vc); in con_init()
3538 vc->vc_can_do_color ? "colour" : "mono", in con_init()
3539 display_desc, vc->vc_cols, vc->vc_rows); in con_init()
3675 struct vc_data *vc = vc_cons[i].d; in do_bind_con_driver() local
3682 if (!vc || !vc->vc_sw) in do_bind_con_driver()
3687 if (con_is_visible(vc)) { in do_bind_con_driver()
3689 save_screen(vc); in do_bind_con_driver()
3692 old_was_color = vc->vc_can_do_color; in do_bind_con_driver()
3693 vc->vc_sw->con_deinit(vc); in do_bind_con_driver()
3694 vc->vc_origin = (unsigned long)vc->vc_screenbuf; in do_bind_con_driver()
3695 visual_init(vc, i, 0); in do_bind_con_driver()
3696 set_origin(vc); in do_bind_con_driver()
3697 update_attr(vc); in do_bind_con_driver()
3703 if (old_was_color != vc->vc_can_do_color) in do_bind_con_driver()
3704 clear_buffer_attributes(vc); in do_bind_con_driver()
3711 struct vc_data *vc = vc_cons[j].d; in do_bind_con_driver() local
3714 vc->vc_can_do_color ? "colour" : "mono", in do_bind_con_driver()
3715 desc, vc->vc_cols, vc->vc_rows); in do_bind_con_driver()
3718 vc = vc_cons[k].d; in do_bind_con_driver()
3719 update_screen(vc); in do_bind_con_driver()
4010 bool con_is_visible(const struct vc_data *vc) in con_is_visible() argument
4014 return *vc->vc_display_fg == vc; in con_is_visible()
4030 int con_debug_enter(struct vc_data *vc) in con_debug_enter() argument
4037 saved_vc_mode = vc->vc_mode; in con_debug_enter()
4039 vc->vc_mode = KD_TEXT; in con_debug_enter()
4041 if (vc->vc_sw->con_debug_enter) in con_debug_enter()
4042 ret = vc->vc_sw->con_debug_enter(vc); in con_debug_enter()
4045 if (vc->vc_rows < 999) { in con_debug_enter()
4054 snprintf(lns, 4, "%i", vc->vc_rows); in con_debug_enter()
4058 if (vc->vc_cols < 999) { in con_debug_enter()
4067 snprintf(cols, 4, "%i", vc->vc_cols); in con_debug_enter()
4088 struct vc_data *vc; in con_debug_leave() local
4097 vc = vc_cons[fg_console].d; in con_debug_leave()
4098 if (vc->vc_sw->con_debug_leave) in con_debug_leave()
4099 ret = vc->vc_sw->con_debug_leave(vc); in con_debug_leave()
4347 struct vc_data *vc = vc_cons[fg_console].d; in do_blank_screen() local
4357 vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0); in do_blank_screen()
4364 hide_cursor(vc); in do_blank_screen()
4365 save_screen(vc); in do_blank_screen()
4366 vc->vc_sw->con_blank(vc, -1, 1); in do_blank_screen()
4369 set_origin(vc); in do_blank_screen()
4376 if (vc->vc_mode != KD_TEXT) { in do_blank_screen()
4381 hide_cursor(vc); in do_blank_screen()
4385 save_screen(vc); in do_blank_screen()
4387 i = vc->vc_sw->con_blank(vc, vesa_off_interval ? 1 : (vesa_blank_mode + 1), 0); in do_blank_screen()
4390 set_origin(vc); in do_blank_screen()
4399 vt_event_post(VT_EVENT_BLANK, vc->vc_num, vc->vc_num); in do_blank_screen()
4408 struct vc_data *vc; in do_unblank_screen() local
4428 vc = vc_cons[fg_console].d; in do_unblank_screen()
4429 if (vc->vc_mode != KD_TEXT) in do_unblank_screen()
4438 if (vc->vc_sw->con_blank(vc, 0, leaving_gfx)) in do_unblank_screen()
4440 update_screen(vc); in do_unblank_screen()
4443 set_palette(vc); in do_unblank_screen()
4444 set_cursor(vc); in do_unblank_screen()
4445 vt_event_post(VT_EVENT_UNBLANK, vc->vc_num, vc->vc_num); in do_unblank_screen()
4503 static void set_palette(struct vc_data *vc) in set_palette() argument
4507 if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_set_palette) in set_palette()
4508 vc->vc_sw->con_set_palette(vc, color_table); in set_palette()
4564 void reset_palette(struct vc_data *vc) in reset_palette() argument
4568 vc->vc_palette[k++] = default_red[j]; in reset_palette()
4569 vc->vc_palette[k++] = default_grn[j]; in reset_palette()
4570 vc->vc_palette[k++] = default_blu[j]; in reset_palette()
4572 set_palette(vc); in reset_palette()
4590 static int con_font_get(struct vc_data *vc, struct console_font_op *op) in con_font_get() argument
4604 if (vc->vc_mode != KD_TEXT) in con_font_get()
4606 else if (vc->vc_sw->con_font_get) in con_font_get()
4607 rc = vc->vc_sw->con_font_get(vc, &font); in con_font_get()
4636 static int con_font_set(struct vc_data *vc, struct console_font_op *op) in con_font_set() argument
4642 if (vc->vc_mode != KD_TEXT) in con_font_set()
4663 if (vc->vc_mode != KD_TEXT) in con_font_set()
4665 else if (vc->vc_sw->con_font_set) { in con_font_set()
4666 if (vc_is_sel(vc)) in con_font_set()
4668 rc = vc->vc_sw->con_font_set(vc, &font, op->flags); in con_font_set()
4676 static int con_font_default(struct vc_data *vc, struct console_font_op *op) in con_font_default() argument
4692 if (vc->vc_mode != KD_TEXT) { in con_font_default()
4696 if (vc->vc_sw->con_font_default) { in con_font_default()
4697 if (vc_is_sel(vc)) in con_font_default()
4699 rc = vc->vc_sw->con_font_default(vc, &font, s); in con_font_default()
4710 int con_font_op(struct vc_data *vc, struct console_font_op *op) in con_font_op() argument
4714 return con_font_set(vc, op); in con_font_op()
4716 return con_font_get(vc, op); in con_font_op()
4718 return con_font_default(vc, op); in con_font_op()
4731 u16 screen_glyph(const struct vc_data *vc, int offset) in screen_glyph() argument
4733 u16 w = scr_readw(screenpos(vc, offset, true)); in screen_glyph()
4736 if (w & vc->vc_hi_font_mask) in screen_glyph()
4742 u32 screen_glyph_unicode(const struct vc_data *vc, int n) in screen_glyph_unicode() argument
4744 struct uni_screen *uniscr = get_vc_uniscr(vc); in screen_glyph_unicode()
4747 return uniscr->lines[n / vc->vc_cols][n % vc->vc_cols]; in screen_glyph_unicode()
4748 return inverse_translate(vc, screen_glyph(vc, n * 2), 1); in screen_glyph_unicode()
4753 unsigned short *screen_pos(const struct vc_data *vc, int w_offset, bool viewed) in screen_pos() argument
4755 return screenpos(vc, 2 * w_offset, viewed); in screen_pos()
4759 void getconsxy(const struct vc_data *vc, unsigned char xy[static 2]) in getconsxy() argument
4762 xy[0] = min(vc->state.x, 0xFFu); in getconsxy()
4763 xy[1] = min(vc->state.y, 0xFFu); in getconsxy()
4766 void putconsxy(struct vc_data *vc, unsigned char xy[static const 2]) in putconsxy() argument
4768 hide_cursor(vc); in putconsxy()
4769 gotoxy(vc, xy[0], xy[1]); in putconsxy()
4770 set_cursor(vc); in putconsxy()
4773 u16 vcs_scr_readw(const struct vc_data *vc, const u16 *org) in vcs_scr_readw() argument
4775 if ((unsigned long)org == vc->vc_pos && softcursor_original != -1) in vcs_scr_readw()
4780 void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org) in vcs_scr_writew() argument
4783 if ((unsigned long)org == vc->vc_pos) { in vcs_scr_writew()
4785 add_softcursor(vc); in vcs_scr_writew()
4789 void vcs_scr_updated(struct vc_data *vc) in vcs_scr_updated() argument
4791 notify_update(vc); in vcs_scr_updated()