Lines Matching refs:vc
144 struct vc vc_cons [MAX_NR_CONSOLES];
151 static void vc_init(struct vc_data *vc, unsigned int rows,
153 static void gotoxy(struct vc_data *vc, int new_x, int new_y);
154 static void save_cur(struct vc_data *vc);
155 static void reset_terminal(struct vc_data *vc, int do_clear);
158 static void set_cursor(struct vc_data *vc);
159 static void hide_cursor(struct vc_data *vc);
163 static void set_palette(struct vc_data *vc);
268 static void notify_write(struct vc_data *vc, unsigned int unicode) in notify_write() argument
270 struct vt_notifier_param param = { .vc = vc, .c = unicode }; in notify_write()
274 static void notify_update(struct vc_data *vc) in notify_update() argument
276 struct vt_notifier_param param = { .vc = vc }; in notify_update()
283 static inline bool con_is_fg(const struct vc_data *vc) in con_is_fg() argument
285 return vc->vc_num == fg_console; in con_is_fg()
288 static inline bool con_should_update(const struct vc_data *vc) in con_should_update() argument
290 return con_is_visible(vc) && !console_blanked; in con_should_update()
293 static inline unsigned short *screenpos(struct vc_data *vc, int offset, int viewed) in screenpos() argument
298 p = (unsigned short *)(vc->vc_origin + offset); in screenpos()
299 else if (!vc->vc_sw->con_screen_pos) in screenpos()
300 p = (unsigned short *)(vc->vc_visible_origin + offset); in screenpos()
302 p = vc->vc_sw->con_screen_pos(vc, offset); in screenpos()
327 #define get_vc_uniscr(vc) NULL argument
329 #define get_vc_uniscr(vc) vc->vc_uni_screen argument
367 static void vc_uniscr_set(struct vc_data *vc, struct uni_screen *new_uniscr) in vc_uniscr_set() argument
369 kfree(vc->vc_uni_screen); in vc_uniscr_set()
370 vc->vc_uni_screen = new_uniscr; in vc_uniscr_set()
373 static void vc_uniscr_putc(struct vc_data *vc, char32_t uc) in vc_uniscr_putc() argument
375 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_putc()
378 uniscr->lines[vc->vc_y][vc->vc_x] = uc; in vc_uniscr_putc()
381 static void vc_uniscr_insert(struct vc_data *vc, unsigned int nr) in vc_uniscr_insert() argument
383 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_insert()
386 char32_t *ln = uniscr->lines[vc->vc_y]; in vc_uniscr_insert()
387 unsigned int x = vc->vc_x, cols = vc->vc_cols; in vc_uniscr_insert()
394 static void vc_uniscr_delete(struct vc_data *vc, unsigned int nr) in vc_uniscr_delete() argument
396 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_delete()
399 char32_t *ln = uniscr->lines[vc->vc_y]; in vc_uniscr_delete()
400 unsigned int x = vc->vc_x, cols = vc->vc_cols; in vc_uniscr_delete()
407 static void vc_uniscr_clear_line(struct vc_data *vc, unsigned int x, in vc_uniscr_clear_line() argument
410 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_clear_line()
413 char32_t *ln = uniscr->lines[vc->vc_y]; in vc_uniscr_clear_line()
419 static void vc_uniscr_clear_lines(struct vc_data *vc, unsigned int y, in vc_uniscr_clear_lines() argument
422 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_clear_lines()
425 unsigned int cols = vc->vc_cols; in vc_uniscr_clear_lines()
432 static void vc_uniscr_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in vc_uniscr_scroll() argument
435 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_scroll()
461 vc_uniscr_clear_lines(vc, clear, nr); in vc_uniscr_scroll()
502 int vc_uniscr_check(struct vc_data *vc) in vc_uniscr_check() argument
513 if (!vc->vc_utf) in vc_uniscr_check()
516 if (vc->vc_uni_screen) in vc_uniscr_check()
519 uniscr = vc_uniscr_alloc(vc->vc_cols, vc->vc_rows); in vc_uniscr_check()
529 p = (unsigned short *)vc->vc_origin; in vc_uniscr_check()
530 mask = vc->vc_hi_font_mask | 0xff; in vc_uniscr_check()
531 for (y = 0; y < vc->vc_rows; y++) { in vc_uniscr_check()
533 for (x = 0; x < vc->vc_cols; x++) { in vc_uniscr_check()
535 line[x] = inverse_translate(vc, glyph, true); in vc_uniscr_check()
539 vc->vc_uni_screen = uniscr; in vc_uniscr_check()
548 void vc_uniscr_copy_line(struct vc_data *vc, void *dest, int viewed, in vc_uniscr_copy_line() argument
551 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_copy_line()
552 int offset = row * vc->vc_size_row + col * 2; in vc_uniscr_copy_line()
557 pos = (unsigned long)screenpos(vc, offset, viewed); in vc_uniscr_copy_line()
558 if (pos >= vc->vc_origin && pos < vc->vc_scr_end) { in vc_uniscr_copy_line()
564 row = (pos - vc->vc_origin) / vc->vc_size_row; in vc_uniscr_copy_line()
565 col = ((pos - vc->vc_origin) % vc->vc_size_row) / 2; in vc_uniscr_copy_line()
575 int mask = vc->vc_hi_font_mask | 0xff; in vc_uniscr_copy_line()
579 *uni_buf++ = inverse_translate(vc, glyph, true); in vc_uniscr_copy_line()
585 static void vc_uniscr_debug_check(struct vc_data *vc) in vc_uniscr_debug_check() argument
587 struct uni_screen *uniscr = get_vc_uniscr(vc); in vc_uniscr_debug_check()
600 p = (unsigned short *)vc->vc_origin; in vc_uniscr_debug_check()
601 mask = vc->vc_hi_font_mask | 0xff; in vc_uniscr_debug_check()
602 for (y = 0; y < vc->vc_rows; y++) { in vc_uniscr_debug_check()
604 for (x = 0; x < vc->vc_cols; x++) { in vc_uniscr_debug_check()
607 int tc = conv_uni_to_pc(vc, uc); in vc_uniscr_debug_check()
609 tc = conv_uni_to_pc(vc, 0xfffd); in vc_uniscr_debug_check()
611 tc = conv_uni_to_pc(vc, '?'); in vc_uniscr_debug_check()
621 static void con_scroll(struct vc_data *vc, unsigned int t, unsigned int b, in con_scroll() argument
628 if (b > vc->vc_rows || t >= b || nr < 1) in con_scroll()
630 vc_uniscr_scroll(vc, t, b, dir, nr); in con_scroll()
631 if (con_is_visible(vc) && vc->vc_sw->con_scroll(vc, t, b, dir, nr)) in con_scroll()
634 s = clear = (u16 *)(vc->vc_origin + vc->vc_size_row * t); in con_scroll()
635 d = (u16 *)(vc->vc_origin + vc->vc_size_row * (t + nr)); in con_scroll()
638 clear = s + (b - t - nr) * vc->vc_cols; in con_scroll()
641 scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row); in con_scroll()
642 scr_memsetw(clear, vc->vc_video_erase_char, vc->vc_size_row * nr); in con_scroll()
645 static void do_update_region(struct vc_data *vc, unsigned long start, int count) in do_update_region() argument
651 if (!vc->vc_sw->con_getxy) { in do_update_region()
652 offset = (start - vc->vc_origin) / 2; in do_update_region()
653 xx = offset % vc->vc_cols; in do_update_region()
654 yy = offset / vc->vc_cols; in do_update_region()
657 start = vc->vc_sw->con_getxy(vc, start, &nxx, &nyy); in do_update_region()
664 while (xx < vc->vc_cols && count) { in do_update_region()
667 vc->vc_sw->con_putcs(vc, q, p-q, yy, startx); in do_update_region()
677 vc->vc_sw->con_putcs(vc, q, p-q, yy, startx); in do_update_region()
682 if (vc->vc_sw->con_getxy) { in do_update_region()
684 start = vc->vc_sw->con_getxy(vc, start, NULL, NULL); in do_update_region()
689 void update_region(struct vc_data *vc, unsigned long start, int count) in update_region() argument
693 if (con_should_update(vc)) { in update_region()
694 hide_cursor(vc); in update_region()
695 do_update_region(vc, start, count); in update_region()
696 set_cursor(vc); in update_region()
702 static u8 build_attr(struct vc_data *vc, u8 _color, u8 _intensity, u8 _blink, 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->vc_color, vc->vc_intensity, in update_attr()
748 vc->vc_blink, vc->vc_underline, in update_attr()
749 vc->vc_reverse ^ vc->vc_decscnm, vc->vc_italic); in update_attr()
750 …vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm, 0) << … in update_attr()
754 void invert_screen(struct vc_data *vc, int offset, int count, int viewed) in invert_screen() argument
761 p = screenpos(vc, offset, viewed); in invert_screen()
762 if (vc->vc_sw->con_invert_region) { in invert_screen()
763 vc->vc_sw->con_invert_region(vc, p, count); in invert_screen()
769 if (!vc->vc_can_do_color) { in invert_screen()
776 } else if (vc->vc_hi_font_mask == 0x100) { in invert_screen()
793 if (con_should_update(vc)) in invert_screen()
794 do_update_region(vc, (unsigned long) p, count); in invert_screen()
795 notify_update(vc); in invert_screen()
799 void complement_pos(struct vc_data *vc, int offset) in complement_pos() argument
808 old_offset < vc->vc_screenbuf_size) { in complement_pos()
809 scr_writew(old, screenpos(vc, old_offset, 1)); in complement_pos()
810 if (con_should_update(vc)) in complement_pos()
811 vc->vc_sw->con_putc(vc, old, oldy, oldx); in complement_pos()
812 notify_update(vc); in complement_pos()
818 offset < vc->vc_screenbuf_size) { in complement_pos()
821 p = screenpos(vc, offset, 1); in complement_pos()
823 new = old ^ vc->vc_complement_mask; in complement_pos()
825 if (con_should_update(vc)) { in complement_pos()
826 oldx = (offset >> 1) % vc->vc_cols; in complement_pos()
827 oldy = (offset >> 1) / vc->vc_cols; in complement_pos()
828 vc->vc_sw->con_putc(vc, new, oldy, oldx); in complement_pos()
830 notify_update(vc); in complement_pos()
834 static void insert_char(struct vc_data *vc, unsigned int nr) in insert_char() argument
836 unsigned short *p = (unsigned short *) vc->vc_pos; in insert_char()
838 vc_uniscr_insert(vc, nr); in insert_char()
839 scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x - nr) * 2); in insert_char()
840 scr_memsetw(p, vc->vc_video_erase_char, nr * 2); in insert_char()
841 vc->vc_need_wrap = 0; in insert_char()
842 if (con_should_update(vc)) in insert_char()
843 do_update_region(vc, (unsigned long) p, in insert_char()
844 vc->vc_cols - vc->vc_x); in insert_char()
847 static void delete_char(struct vc_data *vc, unsigned int nr) in delete_char() argument
849 unsigned short *p = (unsigned short *) vc->vc_pos; in delete_char()
851 vc_uniscr_delete(vc, nr); in delete_char()
852 scr_memcpyw(p, p + nr, (vc->vc_cols - vc->vc_x - nr) * 2); in delete_char()
853 scr_memsetw(p + vc->vc_cols - vc->vc_x - nr, vc->vc_video_erase_char, in delete_char()
855 vc->vc_need_wrap = 0; in delete_char()
856 if (con_should_update(vc)) in delete_char()
857 do_update_region(vc, (unsigned long) p, in delete_char()
858 vc->vc_cols - vc->vc_x); in delete_char()
863 static void add_softcursor(struct vc_data *vc) in add_softcursor() argument
865 int i = scr_readw((u16 *) vc->vc_pos); in add_softcursor()
866 u32 type = vc->vc_cursor_type; in add_softcursor()
875 scr_writew(i, (u16 *) vc->vc_pos); in add_softcursor()
876 if (con_should_update(vc)) in add_softcursor()
877 vc->vc_sw->con_putc(vc, i, vc->vc_y, vc->vc_x); in add_softcursor()
880 static void hide_softcursor(struct vc_data *vc) in hide_softcursor() argument
883 scr_writew(softcursor_original, (u16 *)vc->vc_pos); in hide_softcursor()
884 if (con_should_update(vc)) in hide_softcursor()
885 vc->vc_sw->con_putc(vc, softcursor_original, in hide_softcursor()
886 vc->vc_y, vc->vc_x); in hide_softcursor()
891 static void hide_cursor(struct vc_data *vc) in hide_cursor() argument
893 if (vc == sel_cons) in hide_cursor()
895 vc->vc_sw->con_cursor(vc, CM_ERASE); in hide_cursor()
896 hide_softcursor(vc); in hide_cursor()
899 static void set_cursor(struct vc_data *vc) in set_cursor() argument
901 if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS) in set_cursor()
903 if (vc->vc_deccm) { in set_cursor()
904 if (vc == sel_cons) in set_cursor()
906 add_softcursor(vc); in set_cursor()
907 if ((vc->vc_cursor_type & 0x0f) != 1) in set_cursor()
908 vc->vc_sw->con_cursor(vc, CM_DRAW); in set_cursor()
910 hide_cursor(vc); in set_cursor()
913 static void set_origin(struct vc_data *vc) in set_origin() argument
917 if (!con_is_visible(vc) || in set_origin()
918 !vc->vc_sw->con_set_origin || in set_origin()
919 !vc->vc_sw->con_set_origin(vc)) in set_origin()
920 vc->vc_origin = (unsigned long)vc->vc_screenbuf; in set_origin()
921 vc->vc_visible_origin = vc->vc_origin; in set_origin()
922 vc->vc_scr_end = vc->vc_origin + vc->vc_screenbuf_size; in set_origin()
923 vc->vc_pos = vc->vc_origin + vc->vc_size_row * vc->vc_y + 2 * vc->vc_x; in set_origin()
926 static void save_screen(struct vc_data *vc) in save_screen() argument
930 if (vc->vc_sw->con_save_screen) in save_screen()
931 vc->vc_sw->con_save_screen(vc); in save_screen()
934 static void flush_scrollback(struct vc_data *vc) in flush_scrollback() argument
938 if (vc->vc_sw->con_flush_scrollback) in flush_scrollback()
939 vc->vc_sw->con_flush_scrollback(vc); in flush_scrollback()
946 void clear_buffer_attributes(struct vc_data *vc) in clear_buffer_attributes() argument
948 unsigned short *p = (unsigned short *)vc->vc_origin; in clear_buffer_attributes()
949 int count = vc->vc_screenbuf_size / 2; in clear_buffer_attributes()
950 int mask = vc->vc_hi_font_mask | 0xff; in clear_buffer_attributes()
953 scr_writew((scr_readw(p)&mask) | (vc->vc_video_erase_char & ~mask), p); in clear_buffer_attributes()
957 void redraw_screen(struct vc_data *vc, int is_switch) in redraw_screen() argument
963 if (!vc) { in redraw_screen()
971 if (old_vc == vc) in redraw_screen()
973 if (!con_is_visible(vc)) in redraw_screen()
975 *vc->vc_display_fg = vc; in redraw_screen()
976 fg_console = vc->vc_num; in redraw_screen()
985 hide_cursor(vc); in redraw_screen()
991 int old_was_color = vc->vc_can_do_color; in redraw_screen()
993 set_origin(vc); in redraw_screen()
994 update = vc->vc_sw->con_switch(vc); in redraw_screen()
995 set_palette(vc); in redraw_screen()
1002 if (old_was_color != vc->vc_can_do_color) { in redraw_screen()
1003 update_attr(vc); in redraw_screen()
1004 clear_buffer_attributes(vc); in redraw_screen()
1008 if ((update && vc->vc_mode != KD_GRAPHICS) || in redraw_screen()
1009 vt_force_oops_output(vc)) in redraw_screen()
1010 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); in redraw_screen()
1012 set_cursor(vc); in redraw_screen()
1016 notify_update(vc); in redraw_screen()
1029 static void visual_init(struct vc_data *vc, int num, int init) in visual_init() argument
1032 if (vc->vc_sw) in visual_init()
1033 module_put(vc->vc_sw->owner); in visual_init()
1034 vc->vc_sw = conswitchp; in visual_init()
1037 vc->vc_sw = con_driver_map[num]; in visual_init()
1039 __module_get(vc->vc_sw->owner); in visual_init()
1040 vc->vc_num = num; in visual_init()
1041 vc->vc_display_fg = &master_display_fg; in visual_init()
1042 if (vc->vc_uni_pagedir_loc) in visual_init()
1043 con_free_unimap(vc); in visual_init()
1044 vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir; in visual_init()
1045 vc->vc_uni_pagedir = NULL; in visual_init()
1046 vc->vc_hi_font_mask = 0; in visual_init()
1047 vc->vc_complement_mask = 0; in visual_init()
1048 vc->vc_can_do_color = 0; in visual_init()
1049 vc->vc_panic_force_write = false; in visual_init()
1050 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in visual_init()
1051 vc->vc_sw->con_init(vc, init); in visual_init()
1052 if (!vc->vc_complement_mask) in visual_init()
1053 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in visual_init()
1054 vc->vc_s_complement_mask = vc->vc_complement_mask; in visual_init()
1055 vc->vc_size_row = vc->vc_cols << 1; in visual_init()
1056 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; in visual_init()
1062 struct vc_data *vc; in vc_allocate() local
1078 param.vc = vc = kzalloc(sizeof(struct vc_data), GFP_KERNEL); in vc_allocate()
1079 if (!vc) in vc_allocate()
1082 vc_cons[currcons].d = vc; in vc_allocate()
1083 tty_port_init(&vc->port); in vc_allocate()
1086 visual_init(vc, currcons, 1); in vc_allocate()
1088 if (!*vc->vc_uni_pagedir_loc) in vc_allocate()
1089 con_set_default_unimap(vc); in vc_allocate()
1091 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL); in vc_allocate()
1092 if (!vc->vc_screenbuf) in vc_allocate()
1100 vc_init(vc, vc->vc_rows, vc->vc_cols, 1); in vc_allocate()
1106 kfree(vc); in vc_allocate()
1111 static inline int resize_screen(struct vc_data *vc, int width, int height, in resize_screen() argument
1117 if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_resize) in resize_screen()
1118 err = vc->vc_sw->con_resize(vc, width, height, user); in resize_screen()
1147 static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, in vc_do_resize() argument
1160 if (!vc) in vc_do_resize()
1163 user = vc->vc_resize_user; in vc_do_resize()
1164 vc->vc_resize_user = 0; in vc_do_resize()
1169 new_cols = (cols ? cols : vc->vc_cols); in vc_do_resize()
1170 new_rows = (lines ? lines : vc->vc_rows); in vc_do_resize()
1174 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) in vc_do_resize()
1183 if (get_vc_uniscr(vc)) { in vc_do_resize()
1191 if (vc == sel_cons) in vc_do_resize()
1194 old_rows = vc->vc_rows; in vc_do_resize()
1195 old_row_size = vc->vc_size_row; in vc_do_resize()
1197 err = resize_screen(vc, new_cols, new_rows, user); in vc_do_resize()
1204 vc->vc_rows = new_rows; in vc_do_resize()
1205 vc->vc_cols = new_cols; in vc_do_resize()
1206 vc->vc_size_row = new_row_size; in vc_do_resize()
1207 vc->vc_screenbuf_size = new_screen_size; in vc_do_resize()
1211 old_origin = vc->vc_origin; in vc_do_resize()
1215 if (vc->vc_y > new_rows) { in vc_do_resize()
1216 if (old_rows - vc->vc_y < new_rows) { in vc_do_resize()
1227 first_copied_row = (vc->vc_y - new_rows/2); in vc_do_resize()
1235 get_vc_uniscr(vc), rlth/2, first_copied_row, in vc_do_resize()
1237 vc_uniscr_set(vc, new_uniscr); in vc_do_resize()
1239 update_attr(vc); in vc_do_resize()
1246 vc->vc_video_erase_char, rrem); in vc_do_resize()
1251 scr_memsetw((void *)new_origin, vc->vc_video_erase_char, in vc_do_resize()
1253 kfree(vc->vc_screenbuf); in vc_do_resize()
1254 vc->vc_screenbuf = newscreen; in vc_do_resize()
1255 vc->vc_screenbuf_size = new_screen_size; in vc_do_resize()
1256 set_origin(vc); in vc_do_resize()
1259 vc->vc_top = 0; in vc_do_resize()
1260 vc->vc_bottom = vc->vc_rows; in vc_do_resize()
1261 gotoxy(vc, vc->vc_x, vc->vc_y); in vc_do_resize()
1262 save_cur(vc); in vc_do_resize()
1269 ws.ws_row = vc->vc_rows; in vc_do_resize()
1270 ws.ws_col = vc->vc_cols; in vc_do_resize()
1271 ws.ws_ypixel = vc->vc_scan_lines; in vc_do_resize()
1275 if (con_is_visible(vc)) in vc_do_resize()
1276 update_screen(vc); in vc_do_resize()
1277 vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); in vc_do_resize()
1293 int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows) in vc_resize() argument
1295 return vc_do_resize(vc->port.tty, vc, cols, rows); in vc_resize()
1312 struct vc_data *vc = tty->driver_data; in vt_resize() local
1316 ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row); in vt_resize()
1323 struct vc_data *vc = NULL; in vc_deallocate() local
1330 param.vc = vc = vc_cons[currcons].d; in vc_deallocate()
1333 vc->vc_sw->con_deinit(vc); in vc_deallocate()
1334 put_pid(vc->vt_pid); in vc_deallocate()
1335 module_put(vc->vc_sw->owner); in vc_deallocate()
1336 vc_uniscr_set(vc, NULL); in vc_deallocate()
1337 kfree(vc->vc_screenbuf); in vc_deallocate()
1340 return vc; in vc_deallocate()
1347 #define set_kbd(vc, x) vt_set_kbd_mode_bit((vc)->vc_num, (x)) argument
1348 #define clr_kbd(vc, x) vt_clr_kbd_mode_bit((vc)->vc_num, (x)) argument
1349 #define is_kbd(vc, x) vt_get_kbd_mode_bit((vc)->vc_num, (x)) argument
1389 static void gotoxy(struct vc_data *vc, int new_x, int new_y) in gotoxy() argument
1394 vc->vc_x = 0; in gotoxy()
1396 if (new_x >= vc->vc_cols) in gotoxy()
1397 vc->vc_x = vc->vc_cols - 1; in gotoxy()
1399 vc->vc_x = new_x; in gotoxy()
1402 if (vc->vc_decom) { in gotoxy()
1403 min_y = vc->vc_top; in gotoxy()
1404 max_y = vc->vc_bottom; in gotoxy()
1407 max_y = vc->vc_rows; in gotoxy()
1410 vc->vc_y = min_y; in gotoxy()
1412 vc->vc_y = max_y - 1; in gotoxy()
1414 vc->vc_y = new_y; in gotoxy()
1415 vc->vc_pos = vc->vc_origin + vc->vc_y * vc->vc_size_row + (vc->vc_x<<1); in gotoxy()
1416 vc->vc_need_wrap = 0; in gotoxy()
1420 static void gotoxay(struct vc_data *vc, int new_x, int new_y) in gotoxay() argument
1422 gotoxy(vc, new_x, vc->vc_decom ? (vc->vc_top + new_y) : new_y); in gotoxay()
1425 void scrollback(struct vc_data *vc) in scrollback() argument
1427 scrolldelta(-(vc->vc_rows / 2)); in scrollback()
1430 void scrollfront(struct vc_data *vc, int lines) in scrollfront() argument
1433 lines = vc->vc_rows / 2; in scrollfront()
1437 static void lf(struct vc_data *vc) in lf() argument
1442 if (vc->vc_y + 1 == vc->vc_bottom) in lf()
1443 con_scroll(vc, vc->vc_top, vc->vc_bottom, SM_UP, 1); in lf()
1444 else if (vc->vc_y < vc->vc_rows - 1) { in lf()
1445 vc->vc_y++; in lf()
1446 vc->vc_pos += vc->vc_size_row; in lf()
1448 vc->vc_need_wrap = 0; in lf()
1449 notify_write(vc, '\n'); in lf()
1452 static void ri(struct vc_data *vc) in ri() argument
1457 if (vc->vc_y == vc->vc_top) in ri()
1458 con_scroll(vc, vc->vc_top, vc->vc_bottom, SM_DOWN, 1); in ri()
1459 else if (vc->vc_y > 0) { in ri()
1460 vc->vc_y--; in ri()
1461 vc->vc_pos -= vc->vc_size_row; in ri()
1463 vc->vc_need_wrap = 0; in ri()
1466 static inline void cr(struct vc_data *vc) in cr() argument
1468 vc->vc_pos -= vc->vc_x << 1; in cr()
1469 vc->vc_need_wrap = vc->vc_x = 0; in cr()
1470 notify_write(vc, '\r'); in cr()
1473 static inline void bs(struct vc_data *vc) in bs() argument
1475 if (vc->vc_x) { in bs()
1476 vc->vc_pos -= 2; in bs()
1477 vc->vc_x--; in bs()
1478 vc->vc_need_wrap = 0; in bs()
1479 notify_write(vc, '\b'); in bs()
1483 static inline void del(struct vc_data *vc) in del() argument
1488 static void csi_J(struct vc_data *vc, int vpar) in csi_J() argument
1495 vc_uniscr_clear_line(vc, vc->vc_x, in csi_J()
1496 vc->vc_cols - vc->vc_x); in csi_J()
1497 vc_uniscr_clear_lines(vc, vc->vc_y + 1, in csi_J()
1498 vc->vc_rows - vc->vc_y - 1); in csi_J()
1499 count = (vc->vc_scr_end - vc->vc_pos) >> 1; in csi_J()
1500 start = (unsigned short *)vc->vc_pos; in csi_J()
1503 vc_uniscr_clear_line(vc, 0, vc->vc_x + 1); in csi_J()
1504 vc_uniscr_clear_lines(vc, 0, vc->vc_y); in csi_J()
1505 count = ((vc->vc_pos - vc->vc_origin) >> 1) + 1; in csi_J()
1506 start = (unsigned short *)vc->vc_origin; in csi_J()
1510 vc_uniscr_clear_lines(vc, 0, vc->vc_rows); in csi_J()
1511 count = vc->vc_cols * vc->vc_rows; in csi_J()
1512 start = (unsigned short *)vc->vc_origin; in csi_J()
1517 scr_memsetw(start, vc->vc_video_erase_char, 2 * count); in csi_J()
1519 set_origin(vc); in csi_J()
1520 flush_scrollback(vc); in csi_J()
1521 if (con_is_visible(vc)) in csi_J()
1522 update_screen(vc); in csi_J()
1523 } else if (con_should_update(vc)) in csi_J()
1524 do_update_region(vc, (unsigned long) start, count); in csi_J()
1525 vc->vc_need_wrap = 0; in csi_J()
1528 static void csi_K(struct vc_data *vc, int vpar) in csi_K() argument
1531 unsigned short *start = (unsigned short *)vc->vc_pos; in csi_K()
1537 count = vc->vc_cols - vc->vc_x; in csi_K()
1540 offset = -vc->vc_x; in csi_K()
1541 count = vc->vc_x + 1; in csi_K()
1544 offset = -vc->vc_x; in csi_K()
1545 count = vc->vc_cols; in csi_K()
1550 vc_uniscr_clear_line(vc, vc->vc_x + offset, count); in csi_K()
1551 scr_memsetw(start + offset, vc->vc_video_erase_char, 2 * count); in csi_K()
1552 vc->vc_need_wrap = 0; in csi_K()
1553 if (con_should_update(vc)) in csi_K()
1554 do_update_region(vc, (unsigned long) start, count); in csi_K()
1557 static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar positions */ in csi_X() argument
1563 count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar; in csi_X()
1565 vc_uniscr_clear_line(vc, vc->vc_x, count); in csi_X()
1566 scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count); in csi_X()
1567 if (con_should_update(vc)) in csi_X()
1568 vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count); in csi_X()
1569 vc->vc_need_wrap = 0; in csi_X()
1572 static void default_attr(struct vc_data *vc) in default_attr() argument
1574 vc->vc_intensity = 1; in default_attr()
1575 vc->vc_italic = 0; in default_attr()
1576 vc->vc_underline = 0; in default_attr()
1577 vc->vc_reverse = 0; in default_attr()
1578 vc->vc_blink = 0; in default_attr()
1579 vc->vc_color = vc->vc_def_color; in default_attr()
1602 static void rgb_foreground(struct vc_data *vc, const struct rgb *c) in rgb_foreground() argument
1615 vc->vc_intensity = 2; in rgb_foreground()
1617 vc->vc_intensity = 2; in rgb_foreground()
1619 vc->vc_intensity = 1; in rgb_foreground()
1621 vc->vc_color = (vc->vc_color & 0xf0) | hue; in rgb_foreground()
1624 static void rgb_background(struct vc_data *vc, const struct rgb *c) in rgb_background() argument
1627 vc->vc_color = (vc->vc_color & 0x0f) in rgb_background()
1640 static int vc_t416_color(struct vc_data *vc, int i, in vc_t416_color() argument
1641 void(*set_color)(struct vc_data *vc, const struct rgb *c)) in vc_t416_color() argument
1646 if (i > vc->vc_npar) in vc_t416_color()
1649 if (vc->vc_par[i] == 5 && i + 1 <= vc->vc_npar) { in vc_t416_color()
1652 rgb_from_256(vc->vc_par[i], &c); in vc_t416_color()
1653 } else if (vc->vc_par[i] == 2 && i + 3 <= vc->vc_npar) { in vc_t416_color()
1655 c.r = vc->vc_par[i + 1]; in vc_t416_color()
1656 c.g = vc->vc_par[i + 2]; in vc_t416_color()
1657 c.b = vc->vc_par[i + 3]; in vc_t416_color()
1662 set_color(vc, &c); in vc_t416_color()
1668 static void csi_m(struct vc_data *vc) in csi_m() argument
1672 for (i = 0; i <= vc->vc_npar; i++) in csi_m()
1673 switch (vc->vc_par[i]) { in csi_m()
1675 default_attr(vc); in csi_m()
1678 vc->vc_intensity = 2; in csi_m()
1681 vc->vc_intensity = 0; in csi_m()
1684 vc->vc_italic = 1; in csi_m()
1692 vc->vc_underline = 1; in csi_m()
1695 vc->vc_blink = 1; in csi_m()
1698 vc->vc_reverse = 1; in csi_m()
1704 vc->vc_translate = set_translate(vc->vc_charset == 0 in csi_m()
1705 ? vc->vc_G0_charset in csi_m()
1706 : vc->vc_G1_charset, vc); in csi_m()
1707 vc->vc_disp_ctrl = 0; in csi_m()
1708 vc->vc_toggle_meta = 0; in csi_m()
1714 vc->vc_translate = set_translate(IBMPC_MAP, vc); in csi_m()
1715 vc->vc_disp_ctrl = 1; in csi_m()
1716 vc->vc_toggle_meta = 0; in csi_m()
1722 vc->vc_translate = set_translate(IBMPC_MAP, vc); in csi_m()
1723 vc->vc_disp_ctrl = 1; in csi_m()
1724 vc->vc_toggle_meta = 1; in csi_m()
1727 vc->vc_intensity = 1; in csi_m()
1730 vc->vc_italic = 0; in csi_m()
1733 vc->vc_underline = 0; in csi_m()
1736 vc->vc_blink = 0; in csi_m()
1739 vc->vc_reverse = 0; in csi_m()
1742 i = vc_t416_color(vc, i, rgb_foreground); in csi_m()
1745 i = vc_t416_color(vc, i, rgb_background); in csi_m()
1748 vc->vc_color = (vc->vc_def_color & 0x0f) | in csi_m()
1749 (vc->vc_color & 0xf0); in csi_m()
1752 vc->vc_color = (vc->vc_def_color & 0xf0) | in csi_m()
1753 (vc->vc_color & 0x0f); in csi_m()
1756 if (vc->vc_par[i] >= 90 && vc->vc_par[i] <= 107) { in csi_m()
1757 if (vc->vc_par[i] < 100) in csi_m()
1758 vc->vc_intensity = 2; in csi_m()
1759 vc->vc_par[i] -= 60; in csi_m()
1761 if (vc->vc_par[i] >= 30 && vc->vc_par[i] <= 37) in csi_m()
1762 vc->vc_color = color_table[vc->vc_par[i] - 30] in csi_m()
1763 | (vc->vc_color & 0xf0); in csi_m()
1764 else if (vc->vc_par[i] >= 40 && vc->vc_par[i] <= 47) in csi_m()
1765 vc->vc_color = (color_table[vc->vc_par[i] - 40] << 4) in csi_m()
1766 | (vc->vc_color & 0x0f); in csi_m()
1769 update_attr(vc); in csi_m()
1781 static void cursor_report(struct vc_data *vc, struct tty_struct *tty) in cursor_report() argument
1785 sprintf(buf, "\033[%d;%dR", vc->vc_y + (vc->vc_decom ? vc->vc_top + 1 : 1), vc->vc_x + 1); in cursor_report()
1815 static void set_mode(struct vc_data *vc, int on_off) in set_mode() argument
1819 for (i = 0; i <= vc->vc_npar; i++) in set_mode()
1820 if (vc->vc_ques) { in set_mode()
1821 switch(vc->vc_par[i]) { /* DEC private modes set/reset */ in set_mode()
1824 set_kbd(vc, decckm); in set_mode()
1826 clr_kbd(vc, decckm); in set_mode()
1830 vc_resize(deccolm ? 132 : 80, vc->vc_rows); in set_mode()
1836 if (vc->vc_decscnm != on_off) { in set_mode()
1837 vc->vc_decscnm = on_off; in set_mode()
1838 invert_screen(vc, 0, vc->vc_screenbuf_size, 0); in set_mode()
1839 update_attr(vc); in set_mode()
1843 vc->vc_decom = on_off; in set_mode()
1844 gotoxay(vc, 0, 0); in set_mode()
1847 vc->vc_decawm = on_off; in set_mode()
1851 set_kbd(vc, decarm); in set_mode()
1853 clr_kbd(vc, decarm); in set_mode()
1856 vc->vc_report_mouse = on_off ? 1 : 0; in set_mode()
1859 vc->vc_deccm = on_off; in set_mode()
1862 vc->vc_report_mouse = on_off ? 2 : 0; in set_mode()
1866 switch(vc->vc_par[i]) { /* ANSI modes set/reset */ in set_mode()
1868 vc->vc_disp_ctrl = on_off; in set_mode()
1871 vc->vc_decim = on_off; in set_mode()
1875 set_kbd(vc, lnm); in set_mode()
1877 clr_kbd(vc, lnm); in set_mode()
1884 static void setterm_command(struct vc_data *vc) in setterm_command() argument
1886 switch(vc->vc_par[0]) { in setterm_command()
1888 if (vc->vc_can_do_color && in setterm_command()
1889 vc->vc_par[1] < 16) { in setterm_command()
1890 vc->vc_ulcolor = color_table[vc->vc_par[1]]; in setterm_command()
1891 if (vc->vc_underline) in setterm_command()
1892 update_attr(vc); in setterm_command()
1896 if (vc->vc_can_do_color && in setterm_command()
1897 vc->vc_par[1] < 16) { in setterm_command()
1898 vc->vc_halfcolor = color_table[vc->vc_par[1]]; in setterm_command()
1899 if (vc->vc_intensity == 0) in setterm_command()
1900 update_attr(vc); in setterm_command()
1904 vc->vc_def_color = vc->vc_attr; in setterm_command()
1905 if (vc->vc_hi_font_mask == 0x100) in setterm_command()
1906 vc->vc_def_color >>= 1; in setterm_command()
1907 default_attr(vc); in setterm_command()
1908 update_attr(vc); in setterm_command()
1911 blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60; in setterm_command()
1915 if (vc->vc_npar >= 1) in setterm_command()
1916 vc->vc_bell_pitch = vc->vc_par[1]; in setterm_command()
1918 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; in setterm_command()
1921 if (vc->vc_npar >= 1) in setterm_command()
1922 vc->vc_bell_duration = (vc->vc_par[1] < 2000) ? in setterm_command()
1923 msecs_to_jiffies(vc->vc_par[1]) : 0; in setterm_command()
1925 vc->vc_bell_duration = DEFAULT_BELL_DURATION; in setterm_command()
1928 if (vc->vc_par[1] >= 1 && vc_cons_allocated(vc->vc_par[1] - 1)) in setterm_command()
1929 set_console(vc->vc_par[1] - 1); in setterm_command()
1935 vesa_off_interval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60 * HZ; in setterm_command()
1941 if (vc->vc_npar >= 1 && vc->vc_par[1] >= 50 && in setterm_command()
1942 vc->vc_par[1] <= USHRT_MAX) in setterm_command()
1943 vc->vc_cur_blink_ms = vc->vc_par[1]; in setterm_command()
1945 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in setterm_command()
1951 static void csi_at(struct vc_data *vc, unsigned int nr) in csi_at() argument
1953 if (nr > vc->vc_cols - vc->vc_x) in csi_at()
1954 nr = vc->vc_cols - vc->vc_x; in csi_at()
1957 insert_char(vc, nr); in csi_at()
1961 static void csi_L(struct vc_data *vc, unsigned int nr) in csi_L() argument
1963 if (nr > vc->vc_rows - vc->vc_y) in csi_L()
1964 nr = vc->vc_rows - vc->vc_y; in csi_L()
1967 con_scroll(vc, vc->vc_y, vc->vc_bottom, SM_DOWN, nr); in csi_L()
1968 vc->vc_need_wrap = 0; in csi_L()
1972 static void csi_P(struct vc_data *vc, unsigned int nr) in csi_P() argument
1974 if (nr > vc->vc_cols - vc->vc_x) in csi_P()
1975 nr = vc->vc_cols - vc->vc_x; in csi_P()
1978 delete_char(vc, nr); in csi_P()
1982 static void csi_M(struct vc_data *vc, unsigned int nr) in csi_M() argument
1984 if (nr > vc->vc_rows - vc->vc_y) in csi_M()
1985 nr = vc->vc_rows - vc->vc_y; in csi_M()
1988 con_scroll(vc, vc->vc_y, vc->vc_bottom, SM_UP, nr); in csi_M()
1989 vc->vc_need_wrap = 0; in csi_M()
1993 static void save_cur(struct vc_data *vc) in save_cur() argument
1995 vc->vc_saved_x = vc->vc_x; in save_cur()
1996 vc->vc_saved_y = vc->vc_y; in save_cur()
1997 vc->vc_s_intensity = vc->vc_intensity; in save_cur()
1998 vc->vc_s_italic = vc->vc_italic; in save_cur()
1999 vc->vc_s_underline = vc->vc_underline; in save_cur()
2000 vc->vc_s_blink = vc->vc_blink; in save_cur()
2001 vc->vc_s_reverse = vc->vc_reverse; in save_cur()
2002 vc->vc_s_charset = vc->vc_charset; in save_cur()
2003 vc->vc_s_color = vc->vc_color; in save_cur()
2004 vc->vc_saved_G0 = vc->vc_G0_charset; in save_cur()
2005 vc->vc_saved_G1 = vc->vc_G1_charset; in save_cur()
2009 static void restore_cur(struct vc_data *vc) in restore_cur() argument
2011 gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y); in restore_cur()
2012 vc->vc_intensity = vc->vc_s_intensity; in restore_cur()
2013 vc->vc_italic = vc->vc_s_italic; in restore_cur()
2014 vc->vc_underline = vc->vc_s_underline; in restore_cur()
2015 vc->vc_blink = vc->vc_s_blink; in restore_cur()
2016 vc->vc_reverse = vc->vc_s_reverse; in restore_cur()
2017 vc->vc_charset = vc->vc_s_charset; in restore_cur()
2018 vc->vc_color = vc->vc_s_color; in restore_cur()
2019 vc->vc_G0_charset = vc->vc_saved_G0; in restore_cur()
2020 vc->vc_G1_charset = vc->vc_saved_G1; in restore_cur()
2021 vc->vc_translate = set_translate(vc->vc_charset ? vc->vc_G1_charset : vc->vc_G0_charset, vc); in restore_cur()
2022 update_attr(vc); in restore_cur()
2023 vc->vc_need_wrap = 0; in restore_cur()
2031 static void reset_terminal(struct vc_data *vc, int do_clear) in reset_terminal() argument
2033 vc->vc_top = 0; in reset_terminal()
2034 vc->vc_bottom = vc->vc_rows; in reset_terminal()
2035 vc->vc_state = ESnormal; in reset_terminal()
2036 vc->vc_ques = 0; in reset_terminal()
2037 vc->vc_translate = set_translate(LAT1_MAP, vc); in reset_terminal()
2038 vc->vc_G0_charset = LAT1_MAP; in reset_terminal()
2039 vc->vc_G1_charset = GRAF_MAP; in reset_terminal()
2040 vc->vc_charset = 0; in reset_terminal()
2041 vc->vc_need_wrap = 0; in reset_terminal()
2042 vc->vc_report_mouse = 0; in reset_terminal()
2043 vc->vc_utf = default_utf8; in reset_terminal()
2044 vc->vc_utf_count = 0; in reset_terminal()
2046 vc->vc_disp_ctrl = 0; in reset_terminal()
2047 vc->vc_toggle_meta = 0; in reset_terminal()
2049 vc->vc_decscnm = 0; in reset_terminal()
2050 vc->vc_decom = 0; in reset_terminal()
2051 vc->vc_decawm = 1; in reset_terminal()
2052 vc->vc_deccm = global_cursor_default; in reset_terminal()
2053 vc->vc_decim = 0; in reset_terminal()
2055 vt_reset_keyboard(vc->vc_num); in reset_terminal()
2057 vc->vc_cursor_type = cur_default; in reset_terminal()
2058 vc->vc_complement_mask = vc->vc_s_complement_mask; in reset_terminal()
2060 default_attr(vc); in reset_terminal()
2061 update_attr(vc); in reset_terminal()
2063 vc->vc_tab_stop[0] = in reset_terminal()
2064 vc->vc_tab_stop[1] = in reset_terminal()
2065 vc->vc_tab_stop[2] = in reset_terminal()
2066 vc->vc_tab_stop[3] = in reset_terminal()
2067 vc->vc_tab_stop[4] = in reset_terminal()
2068 vc->vc_tab_stop[5] = in reset_terminal()
2069 vc->vc_tab_stop[6] = in reset_terminal()
2070 vc->vc_tab_stop[7] = 0x01010101; in reset_terminal()
2072 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; in reset_terminal()
2073 vc->vc_bell_duration = DEFAULT_BELL_DURATION; in reset_terminal()
2074 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in reset_terminal()
2076 gotoxy(vc, 0, 0); in reset_terminal()
2077 save_cur(vc); in reset_terminal()
2079 csi_J(vc, 2); in reset_terminal()
2083 static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) in do_con_trol() argument
2089 if (vc->vc_state == ESosc && c>=8 && c<=13) /* ... except for OSC */ in do_con_trol()
2095 if (vc->vc_state == ESosc) in do_con_trol()
2096 vc->vc_state = ESnormal; in do_con_trol()
2097 else if (vc->vc_bell_duration) in do_con_trol()
2098 kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration); in do_con_trol()
2101 bs(vc); in do_con_trol()
2104 vc->vc_pos -= (vc->vc_x << 1); in do_con_trol()
2105 while (vc->vc_x < vc->vc_cols - 1) { in do_con_trol()
2106 vc->vc_x++; in do_con_trol()
2107 if (vc->vc_tab_stop[7 & (vc->vc_x >> 5)] & (1 << (vc->vc_x & 31))) in do_con_trol()
2110 vc->vc_pos += (vc->vc_x << 1); in do_con_trol()
2111 notify_write(vc, '\t'); in do_con_trol()
2114 lf(vc); in do_con_trol()
2115 if (!is_kbd(vc, lnm)) in do_con_trol()
2118 cr(vc); in do_con_trol()
2121 vc->vc_charset = 1; in do_con_trol()
2122 vc->vc_translate = set_translate(vc->vc_G1_charset, vc); in do_con_trol()
2123 vc->vc_disp_ctrl = 1; in do_con_trol()
2126 vc->vc_charset = 0; in do_con_trol()
2127 vc->vc_translate = set_translate(vc->vc_G0_charset, vc); in do_con_trol()
2128 vc->vc_disp_ctrl = 0; in do_con_trol()
2131 vc->vc_state = ESnormal; in do_con_trol()
2134 vc->vc_state = ESesc; in do_con_trol()
2137 del(vc); in do_con_trol()
2140 vc->vc_state = ESsquare; in do_con_trol()
2143 switch(vc->vc_state) { in do_con_trol()
2145 vc->vc_state = ESnormal; in do_con_trol()
2148 vc->vc_state = ESsquare; in do_con_trol()
2151 vc->vc_state = ESnonstd; in do_con_trol()
2154 vc->vc_state = ESpercent; in do_con_trol()
2157 cr(vc); in do_con_trol()
2158 lf(vc); in do_con_trol()
2161 ri(vc); in do_con_trol()
2164 lf(vc); in do_con_trol()
2167 vc->vc_tab_stop[7 & (vc->vc_x >> 5)] |= (1 << (vc->vc_x & 31)); in do_con_trol()
2173 save_cur(vc); in do_con_trol()
2176 restore_cur(vc); in do_con_trol()
2179 vc->vc_state = ESsetG0; in do_con_trol()
2182 vc->vc_state = ESsetG1; in do_con_trol()
2185 vc->vc_state = EShash; in do_con_trol()
2188 reset_terminal(vc, 1); in do_con_trol()
2191 clr_kbd(vc, kbdapplic); in do_con_trol()
2194 set_kbd(vc, kbdapplic); in do_con_trol()
2200 for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++) in do_con_trol()
2201 vc->vc_par[vc->vc_npar] = 0; in do_con_trol()
2202 vc->vc_npar = 0; in do_con_trol()
2203 vc->vc_state = ESpalette; in do_con_trol()
2206 reset_palette(vc); in do_con_trol()
2207 vc->vc_state = ESnormal; in do_con_trol()
2209 vc->vc_state = ESosc; in do_con_trol()
2211 vc->vc_state = ESnormal; in do_con_trol()
2215 vc->vc_par[vc->vc_npar++] = hex_to_bin(c); in do_con_trol()
2216 if (vc->vc_npar == 7) { in do_con_trol()
2217 int i = vc->vc_par[0] * 3, j = 1; in do_con_trol()
2218 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2219 vc->vc_palette[i++] += vc->vc_par[j++]; in do_con_trol()
2220 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2221 vc->vc_palette[i++] += vc->vc_par[j++]; in do_con_trol()
2222 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2223 vc->vc_palette[i] += vc->vc_par[j]; in do_con_trol()
2224 set_palette(vc); in do_con_trol()
2225 vc->vc_state = ESnormal; in do_con_trol()
2228 vc->vc_state = ESnormal; in do_con_trol()
2231 for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++) in do_con_trol()
2232 vc->vc_par[vc->vc_npar] = 0; in do_con_trol()
2233 vc->vc_npar = 0; in do_con_trol()
2234 vc->vc_state = ESgetpars; in do_con_trol()
2236 vc->vc_state=ESfunckey; in do_con_trol()
2239 vc->vc_ques = (c == '?'); in do_con_trol()
2240 if (vc->vc_ques) in do_con_trol()
2243 if (c == ';' && vc->vc_npar < NPAR - 1) { in do_con_trol()
2244 vc->vc_npar++; in do_con_trol()
2247 vc->vc_par[vc->vc_npar] *= 10; in do_con_trol()
2248 vc->vc_par[vc->vc_npar] += c - '0'; in do_con_trol()
2251 vc->vc_state = ESnormal; in do_con_trol()
2254 set_mode(vc, 1); in do_con_trol()
2257 set_mode(vc, 0); in do_con_trol()
2260 if (vc->vc_ques) { in do_con_trol()
2261 if (vc->vc_par[0]) in do_con_trol()
2262 vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16); in do_con_trol()
2264 vc->vc_cursor_type = cur_default; in do_con_trol()
2269 if (vc->vc_ques) { in do_con_trol()
2271 if (vc->vc_par[0]) in do_con_trol()
2272 vc->vc_complement_mask = vc->vc_par[0] << 8 | vc->vc_par[1]; in do_con_trol()
2274 vc->vc_complement_mask = vc->vc_s_complement_mask; in do_con_trol()
2279 if (!vc->vc_ques) { in do_con_trol()
2280 if (vc->vc_par[0] == 5) in do_con_trol()
2282 else if (vc->vc_par[0] == 6) in do_con_trol()
2283 cursor_report(vc, tty); in do_con_trol()
2287 if (vc->vc_ques) { in do_con_trol()
2288 vc->vc_ques = 0; in do_con_trol()
2293 if (vc->vc_par[0]) in do_con_trol()
2294 vc->vc_par[0]--; in do_con_trol()
2295 gotoxy(vc, vc->vc_par[0], vc->vc_y); in do_con_trol()
2298 if (!vc->vc_par[0]) in do_con_trol()
2299 vc->vc_par[0]++; in do_con_trol()
2300 gotoxy(vc, vc->vc_x, vc->vc_y - vc->vc_par[0]); in do_con_trol()
2303 if (!vc->vc_par[0]) in do_con_trol()
2304 vc->vc_par[0]++; in do_con_trol()
2305 gotoxy(vc, vc->vc_x, vc->vc_y + vc->vc_par[0]); in do_con_trol()
2308 if (!vc->vc_par[0]) in do_con_trol()
2309 vc->vc_par[0]++; in do_con_trol()
2310 gotoxy(vc, vc->vc_x + vc->vc_par[0], vc->vc_y); in do_con_trol()
2313 if (!vc->vc_par[0]) in do_con_trol()
2314 vc->vc_par[0]++; in do_con_trol()
2315 gotoxy(vc, vc->vc_x - vc->vc_par[0], vc->vc_y); in do_con_trol()
2318 if (!vc->vc_par[0]) in do_con_trol()
2319 vc->vc_par[0]++; in do_con_trol()
2320 gotoxy(vc, 0, vc->vc_y + vc->vc_par[0]); in do_con_trol()
2323 if (!vc->vc_par[0]) in do_con_trol()
2324 vc->vc_par[0]++; in do_con_trol()
2325 gotoxy(vc, 0, vc->vc_y - vc->vc_par[0]); in do_con_trol()
2328 if (vc->vc_par[0]) in do_con_trol()
2329 vc->vc_par[0]--; in do_con_trol()
2330 gotoxay(vc, vc->vc_x ,vc->vc_par[0]); in do_con_trol()
2333 if (vc->vc_par[0]) in do_con_trol()
2334 vc->vc_par[0]--; in do_con_trol()
2335 if (vc->vc_par[1]) in do_con_trol()
2336 vc->vc_par[1]--; in do_con_trol()
2337 gotoxay(vc, vc->vc_par[1], vc->vc_par[0]); in do_con_trol()
2340 csi_J(vc, vc->vc_par[0]); in do_con_trol()
2343 csi_K(vc, vc->vc_par[0]); in do_con_trol()
2346 csi_L(vc, vc->vc_par[0]); in do_con_trol()
2349 csi_M(vc, vc->vc_par[0]); in do_con_trol()
2352 csi_P(vc, vc->vc_par[0]); in do_con_trol()
2355 if (!vc->vc_par[0]) in do_con_trol()
2359 if (!vc->vc_par[0]) in do_con_trol()
2360 vc->vc_tab_stop[7 & (vc->vc_x >> 5)] &= ~(1 << (vc->vc_x & 31)); in do_con_trol()
2361 else if (vc->vc_par[0] == 3) { in do_con_trol()
2362 vc->vc_tab_stop[0] = in do_con_trol()
2363 vc->vc_tab_stop[1] = in do_con_trol()
2364 vc->vc_tab_stop[2] = in do_con_trol()
2365 vc->vc_tab_stop[3] = in do_con_trol()
2366 vc->vc_tab_stop[4] = in do_con_trol()
2367 vc->vc_tab_stop[5] = in do_con_trol()
2368 vc->vc_tab_stop[6] = in do_con_trol()
2369 vc->vc_tab_stop[7] = 0; in do_con_trol()
2373 csi_m(vc); in do_con_trol()
2377 if (vc->vc_par[0] < 4) in do_con_trol()
2378 vt_set_led_state(vc->vc_num, in do_con_trol()
2379 (vc->vc_par[0] < 3) ? vc->vc_par[0] : 4); in do_con_trol()
2382 if (!vc->vc_par[0]) in do_con_trol()
2383 vc->vc_par[0]++; in do_con_trol()
2384 if (!vc->vc_par[1]) in do_con_trol()
2385 vc->vc_par[1] = vc->vc_rows; in do_con_trol()
2387 if (vc->vc_par[0] < vc->vc_par[1] && in do_con_trol()
2388 vc->vc_par[1] <= vc->vc_rows) { in do_con_trol()
2389 vc->vc_top = vc->vc_par[0] - 1; in do_con_trol()
2390 vc->vc_bottom = vc->vc_par[1]; in do_con_trol()
2391 gotoxay(vc, 0, 0); in do_con_trol()
2395 save_cur(vc); in do_con_trol()
2398 restore_cur(vc); in do_con_trol()
2401 csi_X(vc, vc->vc_par[0]); in do_con_trol()
2404 csi_at(vc, vc->vc_par[0]); in do_con_trol()
2407 setterm_command(vc); in do_con_trol()
2412 vc->vc_state = ESnormal; in do_con_trol()
2415 vc->vc_utf = 0; in do_con_trol()
2419 vc->vc_utf = 1; in do_con_trol()
2424 vc->vc_state = ESnormal; in do_con_trol()
2427 vc->vc_state = ESnormal; in do_con_trol()
2430 vc->vc_video_erase_char = in do_con_trol()
2431 (vc->vc_video_erase_char & 0xff00) | 'E'; in do_con_trol()
2432 csi_J(vc, 2); in do_con_trol()
2433 vc->vc_video_erase_char = in do_con_trol()
2434 (vc->vc_video_erase_char & 0xff00) | ' '; in do_con_trol()
2435 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); in do_con_trol()
2440 vc->vc_G0_charset = GRAF_MAP; in do_con_trol()
2442 vc->vc_G0_charset = LAT1_MAP; in do_con_trol()
2444 vc->vc_G0_charset = IBMPC_MAP; in do_con_trol()
2446 vc->vc_G0_charset = USER_MAP; in do_con_trol()
2447 if (vc->vc_charset == 0) in do_con_trol()
2448 vc->vc_translate = set_translate(vc->vc_G0_charset, vc); in do_con_trol()
2449 vc->vc_state = ESnormal; in do_con_trol()
2453 vc->vc_G1_charset = GRAF_MAP; in do_con_trol()
2455 vc->vc_G1_charset = LAT1_MAP; in do_con_trol()
2457 vc->vc_G1_charset = IBMPC_MAP; in do_con_trol()
2459 vc->vc_G1_charset = USER_MAP; in do_con_trol()
2460 if (vc->vc_charset == 1) in do_con_trol()
2461 vc->vc_translate = set_translate(vc->vc_G1_charset, vc); in do_con_trol()
2462 vc->vc_state = ESnormal; in do_con_trol()
2467 vc->vc_state = ESnormal; in do_con_trol()
2508 static void con_flush(struct vc_data *vc, unsigned long draw_from, in con_flush() argument
2514 vc->vc_sw->con_putcs(vc, (u16 *)draw_from, in con_flush()
2515 (u16 *)draw_to - (u16 *)draw_from, vc->vc_y, *draw_x); in con_flush()
2525 struct vc_data *vc; in do_con_write() local
2539 vc = tty->driver_data; in do_con_write()
2540 if (vc == NULL) { in do_con_write()
2546 currcons = vc->vc_num; in do_con_write()
2554 himask = vc->vc_hi_font_mask; in do_con_write()
2558 if (con_is_fg(vc)) in do_con_write()
2559 hide_cursor(vc); in do_con_write()
2561 param.vc = vc; in do_con_write()
2574 if (vc->vc_state != ESnormal) { in do_con_write()
2576 } else if (vc->vc_utf && !vc->vc_disp_ctrl) { in do_con_write()
2587 if (vc->vc_utf_count) { in do_con_write()
2588 vc->vc_utf_char = (vc->vc_utf_char << 6) | (c & 0x3f); in do_con_write()
2589 vc->vc_npar++; in do_con_write()
2590 if (--vc->vc_utf_count) { in do_con_write()
2595 c = vc->vc_utf_char; in do_con_write()
2597 if (c <= utf8_length_changes[vc->vc_npar - 1] || in do_con_write()
2598 c > utf8_length_changes[vc->vc_npar]) in do_con_write()
2602 vc->vc_utf_count = 0; in do_con_write()
2607 if (vc->vc_utf_count) { in do_con_write()
2610 vc->vc_utf_count = 0; in do_con_write()
2614 vc->vc_npar = 0; in do_con_write()
2616 vc->vc_utf_count = 1; in do_con_write()
2617 vc->vc_utf_char = (c & 0x1f); in do_con_write()
2619 vc->vc_utf_count = 2; in do_con_write()
2620 vc->vc_utf_char = (c & 0x0f); in do_con_write()
2622 vc->vc_utf_count = 3; in do_con_write()
2623 vc->vc_utf_char = (c & 0x07); in do_con_write()
2625 vc->vc_utf_count = 4; in do_con_write()
2626 vc->vc_utf_char = (c & 0x03); in do_con_write()
2628 vc->vc_utf_count = 5; in do_con_write()
2629 vc->vc_utf_char = (c & 0x01); in do_con_write()
2634 if (vc->vc_utf_count) { in do_con_write()
2648 tc = vc_translate(vc, c); in do_con_write()
2667 !(vc->vc_disp_ctrl ? (CTRL_ALWAYS >> c) & 1 : in do_con_write()
2668 vc->vc_utf || ((CTRL_ACTION >> c) & 1))) in do_con_write()
2669 && (c != 127 || vc->vc_disp_ctrl) in do_con_write()
2672 if (vc->vc_state == ESnormal && ok) { in do_con_write()
2673 if (vc->vc_utf && !vc->vc_disp_ctrl) { in do_con_write()
2678 tc = conv_uni_to_pc(vc, tc); in do_con_write()
2684 if ((!(vc->vc_utf && !vc->vc_disp_ctrl) || c < 128) && !(c & ~charmask)) { in do_con_write()
2693 tc = conv_uni_to_pc(vc, 0xfffd); in do_con_write()
2696 tc = conv_uni_to_pc(vc, '?'); in do_con_write()
2703 vc_attr = vc->vc_attr; in do_con_write()
2706 if (!vc->vc_can_do_color) { in do_con_write()
2707 vc_attr = (vc->vc_attr) ^ 0x08; in do_con_write()
2708 } else if (vc->vc_hi_font_mask == 0x100) { in do_con_write()
2709 … vc_attr = ((vc->vc_attr) & 0x11) | (((vc->vc_attr) & 0xe0) >> 4) | (((vc->vc_attr) & 0x0e) << 4); in do_con_write()
2711 … vc_attr = ((vc->vc_attr) & 0x88) | (((vc->vc_attr) & 0x70) >> 4) | (((vc->vc_attr) & 0x07) << 4); in do_con_write()
2713 con_flush(vc, draw_from, draw_to, &draw_x); in do_con_write()
2718 if (vc->vc_need_wrap || vc->vc_decim) in do_con_write()
2719 con_flush(vc, draw_from, draw_to, in do_con_write()
2721 if (vc->vc_need_wrap) { in do_con_write()
2722 cr(vc); in do_con_write()
2723 lf(vc); in do_con_write()
2725 if (vc->vc_decim) in do_con_write()
2726 insert_char(vc, 1); in do_con_write()
2727 vc_uniscr_putc(vc, next_c); in do_con_write()
2731 (u16 *) vc->vc_pos); in do_con_write()
2732 if (con_should_update(vc) && draw_x < 0) { in do_con_write()
2733 draw_x = vc->vc_x; in do_con_write()
2734 draw_from = vc->vc_pos; in do_con_write()
2736 if (vc->vc_x == vc->vc_cols - 1) { in do_con_write()
2737 vc->vc_need_wrap = vc->vc_decawm; in do_con_write()
2738 draw_to = vc->vc_pos + 2; in do_con_write()
2740 vc->vc_x++; in do_con_write()
2741 draw_to = (vc->vc_pos += 2); in do_con_write()
2746 tc = conv_uni_to_pc(vc, ' '); /* A space is printed in the second column */ in do_con_write()
2750 notify_write(vc, c); in do_con_write()
2753 con_flush(vc, draw_from, draw_to, &draw_x); in do_con_write()
2764 con_flush(vc, draw_from, draw_to, &draw_x); in do_con_write()
2765 do_con_trol(tty, vc, orig); in do_con_write()
2767 con_flush(vc, draw_from, draw_to, &draw_x); in do_con_write()
2768 vc_uniscr_debug_check(vc); in do_con_write()
2771 notify_update(vc); in do_con_write()
2804 struct vc_data *vc = vc_cons[fg_console].d; in console_callback() local
2806 if (vc->vc_mode == KD_TEXT && vc->vc_sw->con_scrolldelta) in console_callback()
2807 vc->vc_sw->con_scrolldelta(vc, scrollback_delta); in console_callback()
2821 struct vc_data *vc = vc_cons[fg_console].d; in set_console() local
2824 (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) { in set_console()
2886 struct vc_data *vc = vc_cons[fg_console].d; in vt_console_print() local
2902 vc = vc_cons[kmsg_console - 1].d; in vt_console_print()
2906 myx = vc->vc_x; in vt_console_print()
2914 if (vc->vc_mode != KD_TEXT && !vt_force_oops_output(vc)) in vt_console_print()
2918 if (con_is_fg(vc)) in vt_console_print()
2919 hide_cursor(vc); in vt_console_print()
2921 start = (ushort *)vc->vc_pos; in vt_console_print()
2927 if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { in vt_console_print()
2929 if (con_is_visible(vc)) in vt_console_print()
2930 vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); in vt_console_print()
2931 vc->vc_x += cnt; in vt_console_print()
2932 if (vc->vc_need_wrap) in vt_console_print()
2933 vc->vc_x--; in vt_console_print()
2937 bs(vc); in vt_console_print()
2938 start = (ushort *)vc->vc_pos; in vt_console_print()
2939 myx = vc->vc_x; in vt_console_print()
2943 lf(vc); in vt_console_print()
2944 cr(vc); in vt_console_print()
2945 start = (ushort *)vc->vc_pos; in vt_console_print()
2946 myx = vc->vc_x; in vt_console_print()
2950 scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); in vt_console_print()
2951 notify_write(vc, c); in vt_console_print()
2953 if (myx == vc->vc_cols - 1) { in vt_console_print()
2954 vc->vc_need_wrap = 1; in vt_console_print()
2957 vc->vc_pos += 2; in vt_console_print()
2961 if (con_is_visible(vc)) in vt_console_print()
2962 vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); in vt_console_print()
2963 vc->vc_x += cnt; in vt_console_print()
2964 if (vc->vc_x == vc->vc_cols) { in vt_console_print()
2965 vc->vc_x--; in vt_console_print()
2966 vc->vc_need_wrap = 1; in vt_console_print()
2969 set_cursor(vc); in vt_console_print()
2970 notify_update(vc); in vt_console_print()
3155 struct vc_data *vc = tty->driver_data; in con_unthrottle() local
3157 wake_up_interruptible(&vc->paste_wait); in con_unthrottle()
3190 struct vc_data *vc; in con_flush_chars() local
3197 vc = tty->driver_data; in con_flush_chars()
3198 if (vc) in con_flush_chars()
3199 set_cursor(vc); in con_flush_chars()
3209 struct vc_data *vc; in con_install() local
3217 vc = vc_cons[currcons].d; in con_install()
3220 if (vc->port.tty) { in con_install()
3225 ret = tty_port_install(&vc->port, driver, tty); in con_install()
3229 tty->driver_data = vc; in con_install()
3230 vc->port.tty = tty; in con_install()
3236 if (vc->vc_utf) in con_install()
3259 struct vc_data *vc = tty->driver_data; in con_shutdown() local
3260 BUG_ON(vc == NULL); in con_shutdown()
3262 vc->port.tty = NULL; in con_shutdown()
3273 static void vc_init(struct vc_data *vc, unsigned int rows, in vc_init() argument
3278 vc->vc_cols = cols; in vc_init()
3279 vc->vc_rows = rows; in vc_init()
3280 vc->vc_size_row = cols << 1; in vc_init()
3281 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; in vc_init()
3283 set_origin(vc); in vc_init()
3284 vc->vc_pos = vc->vc_origin; in vc_init()
3285 reset_vc(vc); in vc_init()
3287 vc->vc_palette[k++] = default_red[j] ; in vc_init()
3288 vc->vc_palette[k++] = default_grn[j] ; in vc_init()
3289 vc->vc_palette[k++] = default_blu[j] ; in vc_init()
3291 vc->vc_def_color = default_color; in vc_init()
3292 vc->vc_ulcolor = default_underline_color; in vc_init()
3293 vc->vc_itcolor = default_italic_color; in vc_init()
3294 vc->vc_halfcolor = 0x08; /* grey */ in vc_init()
3295 init_waitqueue_head(&vc->paste_wait); in vc_init()
3296 reset_terminal(vc, do_clear); in vc_init()
3308 struct vc_data *vc; in con_init() local
3343 vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT); in con_init()
3345 tty_port_init(&vc->port); in con_init()
3346 visual_init(vc, currcons, 1); in con_init()
3347 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); in con_init()
3348 vc_init(vc, vc->vc_rows, vc->vc_cols, in con_init()
3349 currcons || !vc->vc_sw->con_save_screen); in con_init()
3352 master_display_fg = vc = vc_cons[currcons].d; in con_init()
3353 set_origin(vc); in con_init()
3354 save_screen(vc); in con_init()
3355 gotoxy(vc, vc->vc_x, vc->vc_y); in con_init()
3356 csi_J(vc, 0); in con_init()
3357 update_screen(vc); in con_init()
3359 vc->vc_can_do_color ? "colour" : "mono", in con_init()
3360 display_desc, vc->vc_cols, vc->vc_rows); in con_init()
3496 struct vc_data *vc = vc_cons[i].d; in do_bind_con_driver() local
3503 if (!vc || !vc->vc_sw) in do_bind_con_driver()
3508 if (con_is_visible(vc)) { in do_bind_con_driver()
3510 save_screen(vc); in do_bind_con_driver()
3513 old_was_color = vc->vc_can_do_color; in do_bind_con_driver()
3514 vc->vc_sw->con_deinit(vc); in do_bind_con_driver()
3515 vc->vc_origin = (unsigned long)vc->vc_screenbuf; in do_bind_con_driver()
3516 visual_init(vc, i, 0); in do_bind_con_driver()
3517 set_origin(vc); in do_bind_con_driver()
3518 update_attr(vc); in do_bind_con_driver()
3524 if (old_was_color != vc->vc_can_do_color) in do_bind_con_driver()
3525 clear_buffer_attributes(vc); in do_bind_con_driver()
3532 struct vc_data *vc = vc_cons[j].d; in do_bind_con_driver() local
3535 vc->vc_can_do_color ? "colour" : "mono", in do_bind_con_driver()
3536 desc, vc->vc_cols, vc->vc_rows); in do_bind_con_driver()
3539 vc = vc_cons[k].d; in do_bind_con_driver()
3540 update_screen(vc); in do_bind_con_driver()
3832 int con_debug_enter(struct vc_data *vc) in con_debug_enter() argument
3839 saved_vc_mode = vc->vc_mode; in con_debug_enter()
3841 vc->vc_mode = KD_TEXT; in con_debug_enter()
3843 if (vc->vc_sw->con_debug_enter) in con_debug_enter()
3844 ret = vc->vc_sw->con_debug_enter(vc); in con_debug_enter()
3847 if (vc->vc_rows < 999) { in con_debug_enter()
3856 snprintf(lns, 4, "%i", vc->vc_rows); in con_debug_enter()
3860 if (vc->vc_cols < 999) { in con_debug_enter()
3869 snprintf(cols, 4, "%i", vc->vc_cols); in con_debug_enter()
3891 struct vc_data *vc; in con_debug_leave() local
3900 vc = vc_cons[fg_console].d; in con_debug_leave()
3901 if (vc->vc_sw->con_debug_leave) in con_debug_leave()
3902 ret = vc->vc_sw->con_debug_leave(vc); in con_debug_leave()
4150 struct vc_data *vc = vc_cons[fg_console].d; in do_blank_screen() local
4158 vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0); in do_blank_screen()
4165 hide_cursor(vc); in do_blank_screen()
4166 save_screen(vc); in do_blank_screen()
4167 vc->vc_sw->con_blank(vc, -1, 1); in do_blank_screen()
4170 set_origin(vc); in do_blank_screen()
4179 if (vc->vc_mode != KD_TEXT) { in do_blank_screen()
4184 hide_cursor(vc); in do_blank_screen()
4188 save_screen(vc); in do_blank_screen()
4190 i = vc->vc_sw->con_blank(vc, vesa_off_interval ? 1 : (vesa_blank_mode + 1), 0); in do_blank_screen()
4193 set_origin(vc); in do_blank_screen()
4202 vt_event_post(VT_EVENT_BLANK, vc->vc_num, vc->vc_num); in do_blank_screen()
4211 struct vc_data *vc; in do_unblank_screen() local
4231 vc = vc_cons[fg_console].d; in do_unblank_screen()
4233 if (vc->vc_mode != KD_TEXT && !vt_force_oops_output(vc)) in do_unblank_screen()
4242 if (vc->vc_sw->con_blank(vc, 0, leaving_gfx) || vt_force_oops_output(vc)) in do_unblank_screen()
4244 update_screen(vc); in do_unblank_screen()
4247 set_palette(vc); in do_unblank_screen()
4248 set_cursor(vc); in do_unblank_screen()
4249 vt_event_post(VT_EVENT_UNBLANK, vc->vc_num, vc->vc_num); in do_unblank_screen()
4307 static void set_palette(struct vc_data *vc) in set_palette() argument
4311 if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_set_palette) in set_palette()
4312 vc->vc_sw->con_set_palette(vc, color_table); in set_palette()
4368 void reset_palette(struct vc_data *vc) in reset_palette() argument
4372 vc->vc_palette[k++] = default_red[j]; in reset_palette()
4373 vc->vc_palette[k++] = default_grn[j]; in reset_palette()
4374 vc->vc_palette[k++] = default_blu[j]; in reset_palette()
4376 set_palette(vc); in reset_palette()
4394 static int con_font_get(struct vc_data *vc, struct console_font_op *op) in con_font_get() argument
4408 if (vc->vc_mode != KD_TEXT) in con_font_get()
4410 else if (vc->vc_sw->con_font_get) in con_font_get()
4411 rc = vc->vc_sw->con_font_get(vc, &font); in con_font_get()
4448 static int con_font_set(struct vc_data *vc, struct console_font_op *op) in con_font_set() argument
4454 if (vc->vc_mode != KD_TEXT) in con_font_set()
4500 if (vc->vc_mode != KD_TEXT) in con_font_set()
4502 else if (vc->vc_sw->con_font_set) in con_font_set()
4503 rc = vc->vc_sw->con_font_set(vc, &font, op->flags); in con_font_set()
4511 static int con_font_default(struct vc_data *vc, struct console_font_op *op) in con_font_default() argument
4527 if (vc->vc_mode != KD_TEXT) { in con_font_default()
4531 if (vc->vc_sw->con_font_default) in con_font_default()
4532 rc = vc->vc_sw->con_font_default(vc, &font, s); in con_font_default()
4543 static int con_font_copy(struct vc_data *vc, struct console_font_op *op) in con_font_copy() argument
4550 if (vc->vc_mode != KD_TEXT) in con_font_copy()
4552 else if (!vc->vc_sw->con_font_copy) in con_font_copy()
4556 else if (con == vc->vc_num) /* nothing to do */ in con_font_copy()
4559 rc = vc->vc_sw->con_font_copy(vc, con); in con_font_copy()
4564 int con_font_op(struct vc_data *vc, struct console_font_op *op) in con_font_op() argument
4568 return con_font_set(vc, op); in con_font_op()
4570 return con_font_get(vc, op); in con_font_op()
4572 return con_font_default(vc, op); in con_font_op()
4574 return con_font_copy(vc, op); in con_font_op()
4584 u16 screen_glyph(struct vc_data *vc, int offset) in screen_glyph() argument
4586 u16 w = scr_readw(screenpos(vc, offset, 1)); in screen_glyph()
4589 if (w & vc->vc_hi_font_mask) in screen_glyph()
4595 u32 screen_glyph_unicode(struct vc_data *vc, int n) in screen_glyph_unicode() argument
4597 struct uni_screen *uniscr = get_vc_uniscr(vc); in screen_glyph_unicode()
4600 return uniscr->lines[n / vc->vc_cols][n % vc->vc_cols]; in screen_glyph_unicode()
4601 return inverse_translate(vc, screen_glyph(vc, n * 2), 1); in screen_glyph_unicode()
4606 unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed) in screen_pos() argument
4608 return screenpos(vc, 2 * w_offset, viewed); in screen_pos()
4612 void getconsxy(struct vc_data *vc, unsigned char *p) in getconsxy() argument
4614 p[0] = vc->vc_x; in getconsxy()
4615 p[1] = vc->vc_y; in getconsxy()
4618 void putconsxy(struct vc_data *vc, unsigned char *p) in putconsxy() argument
4620 hide_cursor(vc); in putconsxy()
4621 gotoxy(vc, p[0], p[1]); in putconsxy()
4622 set_cursor(vc); in putconsxy()
4625 u16 vcs_scr_readw(struct vc_data *vc, const u16 *org) in vcs_scr_readw() argument
4627 if ((unsigned long)org == vc->vc_pos && softcursor_original != -1) in vcs_scr_readw()
4632 void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org) in vcs_scr_writew() argument
4635 if ((unsigned long)org == vc->vc_pos) { in vcs_scr_writew()
4637 add_softcursor(vc); in vcs_scr_writew()
4641 void vcs_scr_updated(struct vc_data *vc) in vcs_scr_updated() argument
4643 notify_update(vc); in vcs_scr_updated()