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()
750vc->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 set_origin(vc); in flush_scrollback()
939 if (vc->vc_sw->con_flush_scrollback) in flush_scrollback()
940 vc->vc_sw->con_flush_scrollback(vc); in flush_scrollback()
942 vc->vc_sw->con_switch(vc); in flush_scrollback()
949 void clear_buffer_attributes(struct vc_data *vc) in clear_buffer_attributes() argument
951 unsigned short *p = (unsigned short *)vc->vc_origin; in clear_buffer_attributes()
952 int count = vc->vc_screenbuf_size / 2; in clear_buffer_attributes()
953 int mask = vc->vc_hi_font_mask | 0xff; in clear_buffer_attributes()
956 scr_writew((scr_readw(p)&mask) | (vc->vc_video_erase_char & ~mask), p); in clear_buffer_attributes()
960 void redraw_screen(struct vc_data *vc, int is_switch) in redraw_screen() argument
966 if (!vc) { in redraw_screen()
974 if (old_vc == vc) in redraw_screen()
976 if (!con_is_visible(vc)) in redraw_screen()
978 *vc->vc_display_fg = vc; in redraw_screen()
979 fg_console = vc->vc_num; in redraw_screen()
988 hide_cursor(vc); in redraw_screen()
994 int old_was_color = vc->vc_can_do_color; in redraw_screen()
996 set_origin(vc); in redraw_screen()
997 update = vc->vc_sw->con_switch(vc); in redraw_screen()
998 set_palette(vc); in redraw_screen()
1005 if (old_was_color != vc->vc_can_do_color) { in redraw_screen()
1006 update_attr(vc); in redraw_screen()
1007 clear_buffer_attributes(vc); in redraw_screen()
1010 if (update && vc->vc_mode != KD_GRAPHICS) in redraw_screen()
1011 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); in redraw_screen()
1013 set_cursor(vc); in redraw_screen()
1017 notify_update(vc); in redraw_screen()
1030 static void visual_init(struct vc_data *vc, int num, int init) in visual_init() argument
1033 if (vc->vc_sw) in visual_init()
1034 module_put(vc->vc_sw->owner); in visual_init()
1035 vc->vc_sw = conswitchp; in visual_init()
1038 vc->vc_sw = con_driver_map[num]; in visual_init()
1040 __module_get(vc->vc_sw->owner); in visual_init()
1041 vc->vc_num = num; in visual_init()
1042 vc->vc_display_fg = &master_display_fg; in visual_init()
1043 if (vc->vc_uni_pagedir_loc) in visual_init()
1044 con_free_unimap(vc); in visual_init()
1045 vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir; in visual_init()
1046 vc->vc_uni_pagedir = NULL; in visual_init()
1047 vc->vc_hi_font_mask = 0; in visual_init()
1048 vc->vc_complement_mask = 0; in visual_init()
1049 vc->vc_can_do_color = 0; 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()
1060 static void visual_deinit(struct vc_data *vc) in visual_deinit() argument
1062 vc->vc_sw->con_deinit(vc); in visual_deinit()
1063 module_put(vc->vc_sw->owner); in visual_deinit()
1069 struct vc_data *vc; in vc_allocate() local
1085 param.vc = vc = kzalloc(sizeof(struct vc_data), GFP_KERNEL); in vc_allocate()
1086 if (!vc) in vc_allocate()
1089 vc_cons[currcons].d = vc; in vc_allocate()
1090 tty_port_init(&vc->port); in vc_allocate()
1093 visual_init(vc, currcons, 1); in vc_allocate()
1095 if (!*vc->vc_uni_pagedir_loc) in vc_allocate()
1096 con_set_default_unimap(vc); in vc_allocate()
1098 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL); in vc_allocate()
1099 if (!vc->vc_screenbuf) in vc_allocate()
1107 vc_init(vc, vc->vc_rows, vc->vc_cols, 1); in vc_allocate()
1113 visual_deinit(vc); in vc_allocate()
1114 kfree(vc); in vc_allocate()
1119 static inline int resize_screen(struct vc_data *vc, int width, int height, in resize_screen() argument
1125 if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_resize) in resize_screen()
1126 err = vc->vc_sw->con_resize(vc, width, height, user); in resize_screen()
1155 static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, in vc_do_resize() argument
1168 if (!vc) in vc_do_resize()
1171 user = vc->vc_resize_user; in vc_do_resize()
1172 vc->vc_resize_user = 0; in vc_do_resize()
1177 new_cols = (cols ? cols : vc->vc_cols); in vc_do_resize()
1178 new_rows = (lines ? lines : vc->vc_rows); in vc_do_resize()
1182 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) in vc_do_resize()
1191 if (get_vc_uniscr(vc)) { in vc_do_resize()
1199 if (vc == sel_cons) in vc_do_resize()
1202 old_rows = vc->vc_rows; in vc_do_resize()
1203 old_row_size = vc->vc_size_row; in vc_do_resize()
1205 err = resize_screen(vc, new_cols, new_rows, user); in vc_do_resize()
1212 vc->vc_rows = new_rows; in vc_do_resize()
1213 vc->vc_cols = new_cols; in vc_do_resize()
1214 vc->vc_size_row = new_row_size; in vc_do_resize()
1215 vc->vc_screenbuf_size = new_screen_size; in vc_do_resize()
1219 old_origin = vc->vc_origin; in vc_do_resize()
1223 if (vc->vc_y > new_rows) { in vc_do_resize()
1224 if (old_rows - vc->vc_y < new_rows) { in vc_do_resize()
1235 first_copied_row = (vc->vc_y - new_rows/2); in vc_do_resize()
1243 get_vc_uniscr(vc), rlth/2, first_copied_row, in vc_do_resize()
1245 vc_uniscr_set(vc, new_uniscr); in vc_do_resize()
1247 update_attr(vc); in vc_do_resize()
1254 vc->vc_video_erase_char, rrem); in vc_do_resize()
1259 scr_memsetw((void *)new_origin, vc->vc_video_erase_char, in vc_do_resize()
1261 kfree(vc->vc_screenbuf); in vc_do_resize()
1262 vc->vc_screenbuf = newscreen; in vc_do_resize()
1263 vc->vc_screenbuf_size = new_screen_size; in vc_do_resize()
1264 set_origin(vc); in vc_do_resize()
1267 vc->vc_top = 0; in vc_do_resize()
1268 vc->vc_bottom = vc->vc_rows; in vc_do_resize()
1269 gotoxy(vc, vc->vc_x, vc->vc_y); in vc_do_resize()
1270 save_cur(vc); in vc_do_resize()
1277 ws.ws_row = vc->vc_rows; in vc_do_resize()
1278 ws.ws_col = vc->vc_cols; in vc_do_resize()
1279 ws.ws_ypixel = vc->vc_scan_lines; in vc_do_resize()
1283 if (con_is_visible(vc)) in vc_do_resize()
1284 update_screen(vc); in vc_do_resize()
1285 vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); in vc_do_resize()
1286 notify_update(vc); in vc_do_resize()
1302 int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows) in vc_resize() argument
1304 return vc_do_resize(vc->port.tty, vc, cols, rows); in vc_resize()
1321 struct vc_data *vc = tty->driver_data; in vt_resize() local
1325 ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row); in vt_resize()
1332 struct vc_data *vc = NULL; in vc_deallocate() local
1339 param.vc = vc = vc_cons[currcons].d; in vc_deallocate()
1342 visual_deinit(vc); in vc_deallocate()
1343 put_pid(vc->vt_pid); in vc_deallocate()
1344 vc_uniscr_set(vc, NULL); in vc_deallocate()
1345 kfree(vc->vc_screenbuf); in vc_deallocate()
1348 return vc; in vc_deallocate()
1357 #define set_kbd(vc, x) vt_set_kbd_mode_bit((vc)->vc_num, (x)) argument
1358 #define clr_kbd(vc, x) vt_clr_kbd_mode_bit((vc)->vc_num, (x)) argument
1359 #define is_kbd(vc, x) vt_get_kbd_mode_bit((vc)->vc_num, (x)) argument
1399 static void gotoxy(struct vc_data *vc, int new_x, int new_y) in gotoxy() argument
1404 vc->vc_x = 0; in gotoxy()
1406 if (new_x >= vc->vc_cols) in gotoxy()
1407 vc->vc_x = vc->vc_cols - 1; in gotoxy()
1409 vc->vc_x = new_x; in gotoxy()
1412 if (vc->vc_decom) { in gotoxy()
1413 min_y = vc->vc_top; in gotoxy()
1414 max_y = vc->vc_bottom; in gotoxy()
1417 max_y = vc->vc_rows; in gotoxy()
1420 vc->vc_y = min_y; in gotoxy()
1422 vc->vc_y = max_y - 1; in gotoxy()
1424 vc->vc_y = new_y; in gotoxy()
1425 vc->vc_pos = vc->vc_origin + vc->vc_y * vc->vc_size_row + (vc->vc_x<<1); in gotoxy()
1426 vc->vc_need_wrap = 0; in gotoxy()
1430 static void gotoxay(struct vc_data *vc, int new_x, int new_y) in gotoxay() argument
1432 gotoxy(vc, new_x, vc->vc_decom ? (vc->vc_top + new_y) : new_y); in gotoxay()
1435 void scrollback(struct vc_data *vc) in scrollback() argument
1437 scrolldelta(-(vc->vc_rows / 2)); in scrollback()
1440 void scrollfront(struct vc_data *vc, int lines) in scrollfront() argument
1443 lines = vc->vc_rows / 2; in scrollfront()
1447 static void lf(struct vc_data *vc) in lf() argument
1452 if (vc->vc_y + 1 == vc->vc_bottom) in lf()
1453 con_scroll(vc, vc->vc_top, vc->vc_bottom, SM_UP, 1); in lf()
1454 else if (vc->vc_y < vc->vc_rows - 1) { in lf()
1455 vc->vc_y++; in lf()
1456 vc->vc_pos += vc->vc_size_row; in lf()
1458 vc->vc_need_wrap = 0; in lf()
1459 notify_write(vc, '\n'); in lf()
1462 static void ri(struct vc_data *vc) in ri() argument
1467 if (vc->vc_y == vc->vc_top) in ri()
1468 con_scroll(vc, vc->vc_top, vc->vc_bottom, SM_DOWN, 1); in ri()
1469 else if (vc->vc_y > 0) { in ri()
1470 vc->vc_y--; in ri()
1471 vc->vc_pos -= vc->vc_size_row; in ri()
1473 vc->vc_need_wrap = 0; in ri()
1476 static inline void cr(struct vc_data *vc) in cr() argument
1478 vc->vc_pos -= vc->vc_x << 1; in cr()
1479 vc->vc_need_wrap = vc->vc_x = 0; in cr()
1480 notify_write(vc, '\r'); in cr()
1483 static inline void bs(struct vc_data *vc) in bs() argument
1485 if (vc->vc_x) { in bs()
1486 vc->vc_pos -= 2; in bs()
1487 vc->vc_x--; in bs()
1488 vc->vc_need_wrap = 0; in bs()
1489 notify_write(vc, '\b'); in bs()
1493 static inline void del(struct vc_data *vc) in del() argument
1498 static void csi_J(struct vc_data *vc, int vpar) in csi_J() argument
1505 vc_uniscr_clear_line(vc, vc->vc_x, in csi_J()
1506 vc->vc_cols - vc->vc_x); in csi_J()
1507 vc_uniscr_clear_lines(vc, vc->vc_y + 1, in csi_J()
1508 vc->vc_rows - vc->vc_y - 1); in csi_J()
1509 count = (vc->vc_scr_end - vc->vc_pos) >> 1; in csi_J()
1510 start = (unsigned short *)vc->vc_pos; in csi_J()
1513 vc_uniscr_clear_line(vc, 0, vc->vc_x + 1); in csi_J()
1514 vc_uniscr_clear_lines(vc, 0, vc->vc_y); in csi_J()
1515 count = ((vc->vc_pos - vc->vc_origin) >> 1) + 1; in csi_J()
1516 start = (unsigned short *)vc->vc_origin; in csi_J()
1519 flush_scrollback(vc); in csi_J()
1522 vc_uniscr_clear_lines(vc, 0, vc->vc_rows); in csi_J()
1523 count = vc->vc_cols * vc->vc_rows; in csi_J()
1524 start = (unsigned short *)vc->vc_origin; in csi_J()
1529 scr_memsetw(start, vc->vc_video_erase_char, 2 * count); in csi_J()
1530 if (con_should_update(vc)) in csi_J()
1531 do_update_region(vc, (unsigned long) start, count); in csi_J()
1532 vc->vc_need_wrap = 0; in csi_J()
1535 static void csi_K(struct vc_data *vc, int vpar) in csi_K() argument
1538 unsigned short *start = (unsigned short *)vc->vc_pos; in csi_K()
1544 count = vc->vc_cols - vc->vc_x; in csi_K()
1547 offset = -vc->vc_x; in csi_K()
1548 count = vc->vc_x + 1; in csi_K()
1551 offset = -vc->vc_x; in csi_K()
1552 count = vc->vc_cols; in csi_K()
1557 vc_uniscr_clear_line(vc, vc->vc_x + offset, count); in csi_K()
1558 scr_memsetw(start + offset, vc->vc_video_erase_char, 2 * count); in csi_K()
1559 vc->vc_need_wrap = 0; in csi_K()
1560 if (con_should_update(vc)) in csi_K()
1561 do_update_region(vc, (unsigned long)(start + offset), count); in csi_K()
1564 static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar positions */ in csi_X() argument
1570 count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar; in csi_X()
1572 vc_uniscr_clear_line(vc, vc->vc_x, count); in csi_X()
1573 scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count); in csi_X()
1574 if (con_should_update(vc)) in csi_X()
1575 vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count); in csi_X()
1576 vc->vc_need_wrap = 0; in csi_X()
1579 static void default_attr(struct vc_data *vc) in default_attr() argument
1581 vc->vc_intensity = 1; in default_attr()
1582 vc->vc_italic = 0; in default_attr()
1583 vc->vc_underline = 0; in default_attr()
1584 vc->vc_reverse = 0; in default_attr()
1585 vc->vc_blink = 0; in default_attr()
1586 vc->vc_color = vc->vc_def_color; in default_attr()
1609 static void rgb_foreground(struct vc_data *vc, const struct rgb *c) in rgb_foreground() argument
1622 vc->vc_intensity = 2; in rgb_foreground()
1624 vc->vc_intensity = 2; in rgb_foreground()
1626 vc->vc_intensity = 1; in rgb_foreground()
1628 vc->vc_color = (vc->vc_color & 0xf0) | hue; in rgb_foreground()
1631 static void rgb_background(struct vc_data *vc, const struct rgb *c) in rgb_background() argument
1634 vc->vc_color = (vc->vc_color & 0x0f) in rgb_background()
1647 static int vc_t416_color(struct vc_data *vc, int i, in vc_t416_color() argument
1648 void(*set_color)(struct vc_data *vc, const struct rgb *c)) in vc_t416_color() argument
1653 if (i > vc->vc_npar) in vc_t416_color()
1656 if (vc->vc_par[i] == 5 && i + 1 <= vc->vc_npar) { in vc_t416_color()
1659 rgb_from_256(vc->vc_par[i], &c); in vc_t416_color()
1660 } else if (vc->vc_par[i] == 2 && i + 3 <= vc->vc_npar) { in vc_t416_color()
1662 c.r = vc->vc_par[i + 1]; in vc_t416_color()
1663 c.g = vc->vc_par[i + 2]; in vc_t416_color()
1664 c.b = vc->vc_par[i + 3]; in vc_t416_color()
1669 set_color(vc, &c); in vc_t416_color()
1675 static void csi_m(struct vc_data *vc) in csi_m() argument
1679 for (i = 0; i <= vc->vc_npar; i++) in csi_m()
1680 switch (vc->vc_par[i]) { in csi_m()
1682 default_attr(vc); in csi_m()
1685 vc->vc_intensity = 2; in csi_m()
1688 vc->vc_intensity = 0; in csi_m()
1691 vc->vc_italic = 1; in csi_m()
1699 vc->vc_underline = 1; in csi_m()
1702 vc->vc_blink = 1; in csi_m()
1705 vc->vc_reverse = 1; in csi_m()
1711 vc->vc_translate = set_translate(vc->vc_charset == 0 in csi_m()
1712 ? vc->vc_G0_charset in csi_m()
1713 : vc->vc_G1_charset, vc); in csi_m()
1714 vc->vc_disp_ctrl = 0; in csi_m()
1715 vc->vc_toggle_meta = 0; in csi_m()
1721 vc->vc_translate = set_translate(IBMPC_MAP, vc); in csi_m()
1722 vc->vc_disp_ctrl = 1; in csi_m()
1723 vc->vc_toggle_meta = 0; in csi_m()
1729 vc->vc_translate = set_translate(IBMPC_MAP, vc); in csi_m()
1730 vc->vc_disp_ctrl = 1; in csi_m()
1731 vc->vc_toggle_meta = 1; in csi_m()
1734 vc->vc_intensity = 1; in csi_m()
1737 vc->vc_italic = 0; in csi_m()
1740 vc->vc_underline = 0; in csi_m()
1743 vc->vc_blink = 0; in csi_m()
1746 vc->vc_reverse = 0; in csi_m()
1749 i = vc_t416_color(vc, i, rgb_foreground); in csi_m()
1752 i = vc_t416_color(vc, i, rgb_background); in csi_m()
1755 vc->vc_color = (vc->vc_def_color & 0x0f) | in csi_m()
1756 (vc->vc_color & 0xf0); in csi_m()
1759 vc->vc_color = (vc->vc_def_color & 0xf0) | in csi_m()
1760 (vc->vc_color & 0x0f); in csi_m()
1763 if (vc->vc_par[i] >= 90 && vc->vc_par[i] <= 107) { in csi_m()
1764 if (vc->vc_par[i] < 100) in csi_m()
1765 vc->vc_intensity = 2; in csi_m()
1766 vc->vc_par[i] -= 60; in csi_m()
1768 if (vc->vc_par[i] >= 30 && vc->vc_par[i] <= 37) in csi_m()
1769 vc->vc_color = color_table[vc->vc_par[i] - 30] in csi_m()
1770 | (vc->vc_color & 0xf0); in csi_m()
1771 else if (vc->vc_par[i] >= 40 && vc->vc_par[i] <= 47) in csi_m()
1772 vc->vc_color = (color_table[vc->vc_par[i] - 40] << 4) in csi_m()
1773 | (vc->vc_color & 0x0f); in csi_m()
1776 update_attr(vc); in csi_m()
1788 static void cursor_report(struct vc_data *vc, struct tty_struct *tty) in cursor_report() argument
1792 sprintf(buf, "\033[%d;%dR", vc->vc_y + (vc->vc_decom ? vc->vc_top + 1 : 1), vc->vc_x + 1); in cursor_report()
1822 static void set_mode(struct vc_data *vc, int on_off) in set_mode() argument
1826 for (i = 0; i <= vc->vc_npar; i++) in set_mode()
1827 if (vc->vc_priv == EPdec) { in set_mode()
1828 switch(vc->vc_par[i]) { /* DEC private modes set/reset */ in set_mode()
1831 set_kbd(vc, decckm); in set_mode()
1833 clr_kbd(vc, decckm); in set_mode()
1837 vc_resize(deccolm ? 132 : 80, vc->vc_rows); in set_mode()
1843 if (vc->vc_decscnm != on_off) { in set_mode()
1844 vc->vc_decscnm = on_off; in set_mode()
1845 invert_screen(vc, 0, vc->vc_screenbuf_size, 0); in set_mode()
1846 update_attr(vc); in set_mode()
1850 vc->vc_decom = on_off; in set_mode()
1851 gotoxay(vc, 0, 0); in set_mode()
1854 vc->vc_decawm = on_off; in set_mode()
1858 set_kbd(vc, decarm); in set_mode()
1860 clr_kbd(vc, decarm); in set_mode()
1863 vc->vc_report_mouse = on_off ? 1 : 0; in set_mode()
1866 vc->vc_deccm = on_off; in set_mode()
1869 vc->vc_report_mouse = on_off ? 2 : 0; in set_mode()
1873 switch(vc->vc_par[i]) { /* ANSI modes set/reset */ in set_mode()
1875 vc->vc_disp_ctrl = on_off; in set_mode()
1878 vc->vc_decim = on_off; in set_mode()
1882 set_kbd(vc, lnm); in set_mode()
1884 clr_kbd(vc, lnm); in set_mode()
1891 static void setterm_command(struct vc_data *vc) in setterm_command() argument
1893 switch(vc->vc_par[0]) { in setterm_command()
1895 if (vc->vc_can_do_color && in setterm_command()
1896 vc->vc_par[1] < 16) { in setterm_command()
1897 vc->vc_ulcolor = color_table[vc->vc_par[1]]; in setterm_command()
1898 if (vc->vc_underline) in setterm_command()
1899 update_attr(vc); in setterm_command()
1903 if (vc->vc_can_do_color && in setterm_command()
1904 vc->vc_par[1] < 16) { in setterm_command()
1905 vc->vc_halfcolor = color_table[vc->vc_par[1]]; in setterm_command()
1906 if (vc->vc_intensity == 0) in setterm_command()
1907 update_attr(vc); in setterm_command()
1911 vc->vc_def_color = vc->vc_attr; in setterm_command()
1912 if (vc->vc_hi_font_mask == 0x100) in setterm_command()
1913 vc->vc_def_color >>= 1; in setterm_command()
1914 default_attr(vc); in setterm_command()
1915 update_attr(vc); in setterm_command()
1918 blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60; in setterm_command()
1922 if (vc->vc_npar >= 1) in setterm_command()
1923 vc->vc_bell_pitch = vc->vc_par[1]; in setterm_command()
1925 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; in setterm_command()
1928 if (vc->vc_npar >= 1) in setterm_command()
1929 vc->vc_bell_duration = (vc->vc_par[1] < 2000) ? in setterm_command()
1930 msecs_to_jiffies(vc->vc_par[1]) : 0; in setterm_command()
1932 vc->vc_bell_duration = DEFAULT_BELL_DURATION; in setterm_command()
1935 if (vc->vc_par[1] >= 1 && vc_cons_allocated(vc->vc_par[1] - 1)) in setterm_command()
1936 set_console(vc->vc_par[1] - 1); in setterm_command()
1942 vesa_off_interval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60 * HZ; in setterm_command()
1948 if (vc->vc_npar >= 1 && vc->vc_par[1] >= 50 && in setterm_command()
1949 vc->vc_par[1] <= USHRT_MAX) in setterm_command()
1950 vc->vc_cur_blink_ms = vc->vc_par[1]; in setterm_command()
1952 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in setterm_command()
1958 static void csi_at(struct vc_data *vc, unsigned int nr) in csi_at() argument
1960 if (nr > vc->vc_cols - vc->vc_x) in csi_at()
1961 nr = vc->vc_cols - vc->vc_x; in csi_at()
1964 insert_char(vc, nr); in csi_at()
1968 static void csi_L(struct vc_data *vc, unsigned int nr) in csi_L() argument
1970 if (nr > vc->vc_rows - vc->vc_y) in csi_L()
1971 nr = vc->vc_rows - vc->vc_y; in csi_L()
1974 con_scroll(vc, vc->vc_y, vc->vc_bottom, SM_DOWN, nr); in csi_L()
1975 vc->vc_need_wrap = 0; in csi_L()
1979 static void csi_P(struct vc_data *vc, unsigned int nr) in csi_P() argument
1981 if (nr > vc->vc_cols - vc->vc_x) in csi_P()
1982 nr = vc->vc_cols - vc->vc_x; in csi_P()
1985 delete_char(vc, nr); in csi_P()
1989 static void csi_M(struct vc_data *vc, unsigned int nr) in csi_M() argument
1991 if (nr > vc->vc_rows - vc->vc_y) in csi_M()
1992 nr = vc->vc_rows - vc->vc_y; in csi_M()
1995 con_scroll(vc, vc->vc_y, vc->vc_bottom, SM_UP, nr); in csi_M()
1996 vc->vc_need_wrap = 0; in csi_M()
2000 static void save_cur(struct vc_data *vc) in save_cur() argument
2002 vc->vc_saved_x = vc->vc_x; in save_cur()
2003 vc->vc_saved_y = vc->vc_y; in save_cur()
2004 vc->vc_s_intensity = vc->vc_intensity; in save_cur()
2005 vc->vc_s_italic = vc->vc_italic; in save_cur()
2006 vc->vc_s_underline = vc->vc_underline; in save_cur()
2007 vc->vc_s_blink = vc->vc_blink; in save_cur()
2008 vc->vc_s_reverse = vc->vc_reverse; in save_cur()
2009 vc->vc_s_charset = vc->vc_charset; in save_cur()
2010 vc->vc_s_color = vc->vc_color; in save_cur()
2011 vc->vc_saved_G0 = vc->vc_G0_charset; in save_cur()
2012 vc->vc_saved_G1 = vc->vc_G1_charset; in save_cur()
2016 static void restore_cur(struct vc_data *vc) in restore_cur() argument
2018 gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y); in restore_cur()
2019 vc->vc_intensity = vc->vc_s_intensity; in restore_cur()
2020 vc->vc_italic = vc->vc_s_italic; in restore_cur()
2021 vc->vc_underline = vc->vc_s_underline; in restore_cur()
2022 vc->vc_blink = vc->vc_s_blink; in restore_cur()
2023 vc->vc_reverse = vc->vc_s_reverse; in restore_cur()
2024 vc->vc_charset = vc->vc_s_charset; in restore_cur()
2025 vc->vc_color = vc->vc_s_color; in restore_cur()
2026 vc->vc_G0_charset = vc->vc_saved_G0; in restore_cur()
2027 vc->vc_G1_charset = vc->vc_saved_G1; in restore_cur()
2028 vc->vc_translate = set_translate(vc->vc_charset ? vc->vc_G1_charset : vc->vc_G0_charset, vc); in restore_cur()
2029 update_attr(vc); in restore_cur()
2030 vc->vc_need_wrap = 0; in restore_cur()
2038 static void reset_terminal(struct vc_data *vc, int do_clear) in reset_terminal() argument
2040 vc->vc_top = 0; in reset_terminal()
2041 vc->vc_bottom = vc->vc_rows; in reset_terminal()
2042 vc->vc_state = ESnormal; in reset_terminal()
2043 vc->vc_priv = EPecma; in reset_terminal()
2044 vc->vc_translate = set_translate(LAT1_MAP, vc); in reset_terminal()
2045 vc->vc_G0_charset = LAT1_MAP; in reset_terminal()
2046 vc->vc_G1_charset = GRAF_MAP; in reset_terminal()
2047 vc->vc_charset = 0; in reset_terminal()
2048 vc->vc_need_wrap = 0; in reset_terminal()
2049 vc->vc_report_mouse = 0; in reset_terminal()
2050 vc->vc_utf = default_utf8; in reset_terminal()
2051 vc->vc_utf_count = 0; in reset_terminal()
2053 vc->vc_disp_ctrl = 0; in reset_terminal()
2054 vc->vc_toggle_meta = 0; in reset_terminal()
2056 vc->vc_decscnm = 0; in reset_terminal()
2057 vc->vc_decom = 0; in reset_terminal()
2058 vc->vc_decawm = 1; in reset_terminal()
2059 vc->vc_deccm = global_cursor_default; in reset_terminal()
2060 vc->vc_decim = 0; in reset_terminal()
2062 vt_reset_keyboard(vc->vc_num); in reset_terminal()
2064 vc->vc_cursor_type = cur_default; in reset_terminal()
2065 vc->vc_complement_mask = vc->vc_s_complement_mask; in reset_terminal()
2067 default_attr(vc); in reset_terminal()
2068 update_attr(vc); in reset_terminal()
2070 vc->vc_tab_stop[0] = in reset_terminal()
2071 vc->vc_tab_stop[1] = in reset_terminal()
2072 vc->vc_tab_stop[2] = in reset_terminal()
2073 vc->vc_tab_stop[3] = in reset_terminal()
2074 vc->vc_tab_stop[4] = in reset_terminal()
2075 vc->vc_tab_stop[5] = in reset_terminal()
2076 vc->vc_tab_stop[6] = in reset_terminal()
2077 vc->vc_tab_stop[7] = 0x01010101; in reset_terminal()
2079 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; in reset_terminal()
2080 vc->vc_bell_duration = DEFAULT_BELL_DURATION; in reset_terminal()
2081 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in reset_terminal()
2083 gotoxy(vc, 0, 0); in reset_terminal()
2084 save_cur(vc); in reset_terminal()
2086 csi_J(vc, 2); in reset_terminal()
2090 static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) in do_con_trol() argument
2096 if (vc->vc_state == ESosc && c>=8 && c<=13) /* ... except for OSC */ in do_con_trol()
2102 if (vc->vc_state == ESosc) in do_con_trol()
2103 vc->vc_state = ESnormal; in do_con_trol()
2104 else if (vc->vc_bell_duration) in do_con_trol()
2105 kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration); in do_con_trol()
2108 bs(vc); in do_con_trol()
2111 vc->vc_pos -= (vc->vc_x << 1); in do_con_trol()
2112 while (vc->vc_x < vc->vc_cols - 1) { in do_con_trol()
2113 vc->vc_x++; in do_con_trol()
2114 if (vc->vc_tab_stop[7 & (vc->vc_x >> 5)] & (1 << (vc->vc_x & 31))) in do_con_trol()
2117 vc->vc_pos += (vc->vc_x << 1); in do_con_trol()
2118 notify_write(vc, '\t'); in do_con_trol()
2121 lf(vc); in do_con_trol()
2122 if (!is_kbd(vc, lnm)) in do_con_trol()
2126 cr(vc); in do_con_trol()
2129 vc->vc_charset = 1; in do_con_trol()
2130 vc->vc_translate = set_translate(vc->vc_G1_charset, vc); in do_con_trol()
2131 vc->vc_disp_ctrl = 1; in do_con_trol()
2134 vc->vc_charset = 0; in do_con_trol()
2135 vc->vc_translate = set_translate(vc->vc_G0_charset, vc); in do_con_trol()
2136 vc->vc_disp_ctrl = 0; in do_con_trol()
2139 vc->vc_state = ESnormal; in do_con_trol()
2142 vc->vc_state = ESesc; in do_con_trol()
2145 del(vc); in do_con_trol()
2148 vc->vc_state = ESsquare; in do_con_trol()
2151 switch(vc->vc_state) { in do_con_trol()
2153 vc->vc_state = ESnormal; in do_con_trol()
2156 vc->vc_state = ESsquare; in do_con_trol()
2159 vc->vc_state = ESnonstd; in do_con_trol()
2162 vc->vc_state = ESpercent; in do_con_trol()
2165 cr(vc); in do_con_trol()
2166 lf(vc); in do_con_trol()
2169 ri(vc); in do_con_trol()
2172 lf(vc); in do_con_trol()
2175 vc->vc_tab_stop[7 & (vc->vc_x >> 5)] |= (1 << (vc->vc_x & 31)); in do_con_trol()
2181 save_cur(vc); in do_con_trol()
2184 restore_cur(vc); in do_con_trol()
2187 vc->vc_state = ESsetG0; in do_con_trol()
2190 vc->vc_state = ESsetG1; in do_con_trol()
2193 vc->vc_state = EShash; in do_con_trol()
2196 reset_terminal(vc, 1); in do_con_trol()
2199 clr_kbd(vc, kbdapplic); in do_con_trol()
2202 set_kbd(vc, kbdapplic); in do_con_trol()
2208 for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++) in do_con_trol()
2209 vc->vc_par[vc->vc_npar] = 0; in do_con_trol()
2210 vc->vc_npar = 0; in do_con_trol()
2211 vc->vc_state = ESpalette; in do_con_trol()
2214 reset_palette(vc); in do_con_trol()
2215 vc->vc_state = ESnormal; in do_con_trol()
2217 vc->vc_state = ESosc; in do_con_trol()
2219 vc->vc_state = ESnormal; in do_con_trol()
2223 vc->vc_par[vc->vc_npar++] = hex_to_bin(c); in do_con_trol()
2224 if (vc->vc_npar == 7) { in do_con_trol()
2225 int i = vc->vc_par[0] * 3, j = 1; in do_con_trol()
2226 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2227 vc->vc_palette[i++] += vc->vc_par[j++]; in do_con_trol()
2228 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2229 vc->vc_palette[i++] += vc->vc_par[j++]; in do_con_trol()
2230 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2231 vc->vc_palette[i] += vc->vc_par[j]; in do_con_trol()
2232 set_palette(vc); in do_con_trol()
2233 vc->vc_state = ESnormal; in do_con_trol()
2236 vc->vc_state = ESnormal; in do_con_trol()
2239 for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++) in do_con_trol()
2240 vc->vc_par[vc->vc_npar] = 0; in do_con_trol()
2241 vc->vc_npar = 0; in do_con_trol()
2242 vc->vc_state = ESgetpars; in do_con_trol()
2244 vc->vc_state=ESfunckey; in do_con_trol()
2249 vc->vc_priv = EPdec; in do_con_trol()
2252 vc->vc_priv = EPgt; in do_con_trol()
2255 vc->vc_priv = EPeq; in do_con_trol()
2258 vc->vc_priv = EPlt; in do_con_trol()
2261 vc->vc_priv = EPecma; in do_con_trol()
2264 if (c == ';' && vc->vc_npar < NPAR - 1) { in do_con_trol()
2265 vc->vc_npar++; in do_con_trol()
2268 vc->vc_par[vc->vc_npar] *= 10; in do_con_trol()
2269 vc->vc_par[vc->vc_npar] += c - '0'; in do_con_trol()
2273 vc->vc_state = EScsiignore; in do_con_trol()
2276 vc->vc_state = ESnormal; in do_con_trol()
2279 if (vc->vc_priv <= EPdec) in do_con_trol()
2280 set_mode(vc, 1); in do_con_trol()
2283 if (vc->vc_priv <= EPdec) in do_con_trol()
2284 set_mode(vc, 0); in do_con_trol()
2287 if (vc->vc_priv == EPdec) { in do_con_trol()
2288 if (vc->vc_par[0]) in do_con_trol()
2289 vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16); in do_con_trol()
2291 vc->vc_cursor_type = cur_default; in do_con_trol()
2296 if (vc->vc_priv == EPdec) { in do_con_trol()
2298 if (vc->vc_par[0]) in do_con_trol()
2299 vc->vc_complement_mask = vc->vc_par[0] << 8 | vc->vc_par[1]; in do_con_trol()
2301 vc->vc_complement_mask = vc->vc_s_complement_mask; in do_con_trol()
2306 if (vc->vc_priv == EPecma) { in do_con_trol()
2307 if (vc->vc_par[0] == 5) in do_con_trol()
2309 else if (vc->vc_par[0] == 6) in do_con_trol()
2310 cursor_report(vc, tty); in do_con_trol()
2314 if (vc->vc_priv != EPecma) { in do_con_trol()
2315 vc->vc_priv = EPecma; in do_con_trol()
2320 if (vc->vc_par[0]) in do_con_trol()
2321 vc->vc_par[0]--; in do_con_trol()
2322 gotoxy(vc, vc->vc_par[0], vc->vc_y); in do_con_trol()
2325 if (!vc->vc_par[0]) in do_con_trol()
2326 vc->vc_par[0]++; in do_con_trol()
2327 gotoxy(vc, vc->vc_x, vc->vc_y - vc->vc_par[0]); in do_con_trol()
2330 if (!vc->vc_par[0]) in do_con_trol()
2331 vc->vc_par[0]++; in do_con_trol()
2332 gotoxy(vc, vc->vc_x, vc->vc_y + vc->vc_par[0]); in do_con_trol()
2335 if (!vc->vc_par[0]) in do_con_trol()
2336 vc->vc_par[0]++; in do_con_trol()
2337 gotoxy(vc, vc->vc_x + vc->vc_par[0], vc->vc_y); in do_con_trol()
2340 if (!vc->vc_par[0]) in do_con_trol()
2341 vc->vc_par[0]++; in do_con_trol()
2342 gotoxy(vc, vc->vc_x - vc->vc_par[0], vc->vc_y); in do_con_trol()
2345 if (!vc->vc_par[0]) in do_con_trol()
2346 vc->vc_par[0]++; in do_con_trol()
2347 gotoxy(vc, 0, vc->vc_y + vc->vc_par[0]); in do_con_trol()
2350 if (!vc->vc_par[0]) in do_con_trol()
2351 vc->vc_par[0]++; in do_con_trol()
2352 gotoxy(vc, 0, vc->vc_y - vc->vc_par[0]); in do_con_trol()
2355 if (vc->vc_par[0]) in do_con_trol()
2356 vc->vc_par[0]--; in do_con_trol()
2357 gotoxay(vc, vc->vc_x ,vc->vc_par[0]); in do_con_trol()
2360 if (vc->vc_par[0]) in do_con_trol()
2361 vc->vc_par[0]--; in do_con_trol()
2362 if (vc->vc_par[1]) in do_con_trol()
2363 vc->vc_par[1]--; in do_con_trol()
2364 gotoxay(vc, vc->vc_par[1], vc->vc_par[0]); in do_con_trol()
2367 csi_J(vc, vc->vc_par[0]); in do_con_trol()
2370 csi_K(vc, vc->vc_par[0]); in do_con_trol()
2373 csi_L(vc, vc->vc_par[0]); in do_con_trol()
2376 csi_M(vc, vc->vc_par[0]); in do_con_trol()
2379 csi_P(vc, vc->vc_par[0]); in do_con_trol()
2382 if (!vc->vc_par[0]) in do_con_trol()
2386 if (!vc->vc_par[0]) in do_con_trol()
2387 vc->vc_tab_stop[7 & (vc->vc_x >> 5)] &= ~(1 << (vc->vc_x & 31)); in do_con_trol()
2388 else if (vc->vc_par[0] == 3) { in do_con_trol()
2389 vc->vc_tab_stop[0] = in do_con_trol()
2390 vc->vc_tab_stop[1] = in do_con_trol()
2391 vc->vc_tab_stop[2] = in do_con_trol()
2392 vc->vc_tab_stop[3] = in do_con_trol()
2393 vc->vc_tab_stop[4] = in do_con_trol()
2394 vc->vc_tab_stop[5] = in do_con_trol()
2395 vc->vc_tab_stop[6] = in do_con_trol()
2396 vc->vc_tab_stop[7] = 0; in do_con_trol()
2400 csi_m(vc); in do_con_trol()
2404 if (vc->vc_par[0] < 4) in do_con_trol()
2405 vt_set_led_state(vc->vc_num, in do_con_trol()
2406 (vc->vc_par[0] < 3) ? vc->vc_par[0] : 4); in do_con_trol()
2409 if (!vc->vc_par[0]) in do_con_trol()
2410 vc->vc_par[0]++; in do_con_trol()
2411 if (!vc->vc_par[1]) in do_con_trol()
2412 vc->vc_par[1] = vc->vc_rows; in do_con_trol()
2414 if (vc->vc_par[0] < vc->vc_par[1] && in do_con_trol()
2415 vc->vc_par[1] <= vc->vc_rows) { in do_con_trol()
2416 vc->vc_top = vc->vc_par[0] - 1; in do_con_trol()
2417 vc->vc_bottom = vc->vc_par[1]; in do_con_trol()
2418 gotoxay(vc, 0, 0); in do_con_trol()
2422 save_cur(vc); in do_con_trol()
2425 restore_cur(vc); in do_con_trol()
2428 csi_X(vc, vc->vc_par[0]); in do_con_trol()
2431 csi_at(vc, vc->vc_par[0]); in do_con_trol()
2434 setterm_command(vc); in do_con_trol()
2441 vc->vc_state = ESnormal; in do_con_trol()
2444 vc->vc_state = ESnormal; in do_con_trol()
2447 vc->vc_utf = 0; in do_con_trol()
2451 vc->vc_utf = 1; in do_con_trol()
2456 vc->vc_state = ESnormal; in do_con_trol()
2459 vc->vc_state = ESnormal; in do_con_trol()
2462 vc->vc_video_erase_char = in do_con_trol()
2463 (vc->vc_video_erase_char & 0xff00) | 'E'; in do_con_trol()
2464 csi_J(vc, 2); in do_con_trol()
2465 vc->vc_video_erase_char = in do_con_trol()
2466 (vc->vc_video_erase_char & 0xff00) | ' '; in do_con_trol()
2467 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); in do_con_trol()
2472 vc->vc_G0_charset = GRAF_MAP; in do_con_trol()
2474 vc->vc_G0_charset = LAT1_MAP; in do_con_trol()
2476 vc->vc_G0_charset = IBMPC_MAP; in do_con_trol()
2478 vc->vc_G0_charset = USER_MAP; in do_con_trol()
2479 if (vc->vc_charset == 0) in do_con_trol()
2480 vc->vc_translate = set_translate(vc->vc_G0_charset, vc); in do_con_trol()
2481 vc->vc_state = ESnormal; in do_con_trol()
2485 vc->vc_G1_charset = GRAF_MAP; in do_con_trol()
2487 vc->vc_G1_charset = LAT1_MAP; in do_con_trol()
2489 vc->vc_G1_charset = IBMPC_MAP; in do_con_trol()
2491 vc->vc_G1_charset = USER_MAP; in do_con_trol()
2492 if (vc->vc_charset == 1) in do_con_trol()
2493 vc->vc_translate = set_translate(vc->vc_G1_charset, vc); in do_con_trol()
2494 vc->vc_state = ESnormal; in do_con_trol()
2499 vc->vc_state = ESnormal; in do_con_trol()
2540 static void con_flush(struct vc_data *vc, unsigned long draw_from, in con_flush() argument
2546 vc->vc_sw->con_putcs(vc, (u16 *)draw_from, in con_flush()
2547 (u16 *)draw_to - (u16 *)draw_from, vc->vc_y, *draw_x); in con_flush()
2557 struct vc_data *vc; in do_con_write() local
2571 vc = tty->driver_data; in do_con_write()
2572 if (vc == NULL) { in do_con_write()
2578 currcons = vc->vc_num; in do_con_write()
2586 himask = vc->vc_hi_font_mask; in do_con_write()
2590 if (con_is_fg(vc)) in do_con_write()
2591 hide_cursor(vc); in do_con_write()
2593 param.vc = vc; in do_con_write()
2606 if (vc->vc_state != ESnormal) { in do_con_write()
2608 } else if (vc->vc_utf && !vc->vc_disp_ctrl) { in do_con_write()
2619 if (vc->vc_utf_count) { in do_con_write()
2620 vc->vc_utf_char = (vc->vc_utf_char << 6) | (c & 0x3f); in do_con_write()
2621 vc->vc_npar++; in do_con_write()
2622 if (--vc->vc_utf_count) { in do_con_write()
2627 c = vc->vc_utf_char; in do_con_write()
2629 if (c <= utf8_length_changes[vc->vc_npar - 1] || in do_con_write()
2630 c > utf8_length_changes[vc->vc_npar]) in do_con_write()
2634 vc->vc_utf_count = 0; in do_con_write()
2639 if (vc->vc_utf_count) { in do_con_write()
2642 vc->vc_utf_count = 0; in do_con_write()
2646 vc->vc_npar = 0; in do_con_write()
2648 vc->vc_utf_count = 1; in do_con_write()
2649 vc->vc_utf_char = (c & 0x1f); in do_con_write()
2651 vc->vc_utf_count = 2; in do_con_write()
2652 vc->vc_utf_char = (c & 0x0f); in do_con_write()
2654 vc->vc_utf_count = 3; in do_con_write()
2655 vc->vc_utf_char = (c & 0x07); in do_con_write()
2657 vc->vc_utf_count = 4; in do_con_write()
2658 vc->vc_utf_char = (c & 0x03); in do_con_write()
2660 vc->vc_utf_count = 5; in do_con_write()
2661 vc->vc_utf_char = (c & 0x01); in do_con_write()
2666 if (vc->vc_utf_count) { in do_con_write()
2680 tc = vc_translate(vc, c); in do_con_write()
2699 !(vc->vc_disp_ctrl ? (CTRL_ALWAYS >> c) & 1 : in do_con_write()
2700 vc->vc_utf || ((CTRL_ACTION >> c) & 1))) in do_con_write()
2701 && (c != 127 || vc->vc_disp_ctrl) in do_con_write()
2704 if (vc->vc_state == ESnormal && ok) { in do_con_write()
2705 if (vc->vc_utf && !vc->vc_disp_ctrl) { in do_con_write()
2710 tc = conv_uni_to_pc(vc, tc); in do_con_write()
2716 if ((!(vc->vc_utf && !vc->vc_disp_ctrl) || c < 128) && !(c & ~charmask)) { in do_con_write()
2725 tc = conv_uni_to_pc(vc, 0xfffd); in do_con_write()
2728 tc = conv_uni_to_pc(vc, '?'); in do_con_write()
2735 vc_attr = vc->vc_attr; in do_con_write()
2738 if (!vc->vc_can_do_color) { in do_con_write()
2739 vc_attr = (vc->vc_attr) ^ 0x08; in do_con_write()
2740 } else if (vc->vc_hi_font_mask == 0x100) { in do_con_write()
2741 … vc_attr = ((vc->vc_attr) & 0x11) | (((vc->vc_attr) & 0xe0) >> 4) | (((vc->vc_attr) & 0x0e) << 4); in do_con_write()
2743 … vc_attr = ((vc->vc_attr) & 0x88) | (((vc->vc_attr) & 0x70) >> 4) | (((vc->vc_attr) & 0x07) << 4); in do_con_write()
2745 con_flush(vc, draw_from, draw_to, &draw_x); in do_con_write()
2750 if (vc->vc_need_wrap || vc->vc_decim) in do_con_write()
2751 con_flush(vc, draw_from, draw_to, in do_con_write()
2753 if (vc->vc_need_wrap) { in do_con_write()
2754 cr(vc); in do_con_write()
2755 lf(vc); in do_con_write()
2757 if (vc->vc_decim) in do_con_write()
2758 insert_char(vc, 1); in do_con_write()
2759 vc_uniscr_putc(vc, next_c); in do_con_write()
2763 (u16 *) vc->vc_pos); in do_con_write()
2764 if (con_should_update(vc) && draw_x < 0) { in do_con_write()
2765 draw_x = vc->vc_x; in do_con_write()
2766 draw_from = vc->vc_pos; in do_con_write()
2768 if (vc->vc_x == vc->vc_cols - 1) { in do_con_write()
2769 vc->vc_need_wrap = vc->vc_decawm; in do_con_write()
2770 draw_to = vc->vc_pos + 2; in do_con_write()
2772 vc->vc_x++; in do_con_write()
2773 draw_to = (vc->vc_pos += 2); in do_con_write()
2778 tc = conv_uni_to_pc(vc, ' '); /* A space is printed in the second column */ in do_con_write()
2782 notify_write(vc, c); in do_con_write()
2785 con_flush(vc, draw_from, draw_to, &draw_x); in do_con_write()
2796 con_flush(vc, draw_from, draw_to, &draw_x); in do_con_write()
2797 do_con_trol(tty, vc, orig); in do_con_write()
2799 con_flush(vc, draw_from, draw_to, &draw_x); in do_con_write()
2800 vc_uniscr_debug_check(vc); in do_con_write()
2802 notify_update(vc); in do_con_write()
2836 struct vc_data *vc = vc_cons[fg_console].d; in console_callback() local
2838 if (vc->vc_mode == KD_TEXT && vc->vc_sw->con_scrolldelta) in console_callback()
2839 vc->vc_sw->con_scrolldelta(vc, scrollback_delta); in console_callback()
2853 struct vc_data *vc = vc_cons[fg_console].d; in set_console() local
2856 (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) { in set_console()
2918 struct vc_data *vc = vc_cons[fg_console].d; in vt_console_print() local
2933 vc = vc_cons[kmsg_console - 1].d; in vt_console_print()
2941 if (vc->vc_mode != KD_TEXT) in vt_console_print()
2945 if (con_is_fg(vc)) in vt_console_print()
2946 hide_cursor(vc); in vt_console_print()
2948 start = (ushort *)vc->vc_pos; in vt_console_print()
2949 start_x = vc->vc_x; in vt_console_print()
2953 if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { in vt_console_print()
2954 if (cnt && con_is_visible(vc)) in vt_console_print()
2955 vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); in vt_console_print()
2958 bs(vc); in vt_console_print()
2959 start = (ushort *)vc->vc_pos; in vt_console_print()
2960 start_x = vc->vc_x; in vt_console_print()
2964 lf(vc); in vt_console_print()
2965 cr(vc); in vt_console_print()
2966 start = (ushort *)vc->vc_pos; in vt_console_print()
2967 start_x = vc->vc_x; in vt_console_print()
2971 vc_uniscr_putc(vc, c); in vt_console_print()
2972 scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); in vt_console_print()
2973 notify_write(vc, c); in vt_console_print()
2975 if (vc->vc_x == vc->vc_cols - 1) { in vt_console_print()
2976 vc->vc_need_wrap = 1; in vt_console_print()
2978 vc->vc_pos += 2; in vt_console_print()
2979 vc->vc_x++; in vt_console_print()
2982 if (cnt && con_is_visible(vc)) in vt_console_print()
2983 vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); in vt_console_print()
2984 set_cursor(vc); in vt_console_print()
2985 notify_update(vc); in vt_console_print()
3171 struct vc_data *vc = tty->driver_data; in con_unthrottle() local
3173 wake_up_interruptible(&vc->paste_wait); in con_unthrottle()
3206 struct vc_data *vc; in con_flush_chars() local
3213 vc = tty->driver_data; in con_flush_chars()
3214 if (vc) in con_flush_chars()
3215 set_cursor(vc); in con_flush_chars()
3225 struct vc_data *vc; in con_install() local
3233 vc = vc_cons[currcons].d; in con_install()
3236 if (vc->port.tty) { in con_install()
3241 ret = tty_port_install(&vc->port, driver, tty); in con_install()
3245 tty->driver_data = vc; in con_install()
3246 vc->port.tty = tty; in con_install()
3252 if (vc->vc_utf) in con_install()
3275 struct vc_data *vc = tty->driver_data; in con_shutdown() local
3276 BUG_ON(vc == NULL); in con_shutdown()
3278 vc->port.tty = NULL; in con_shutdown()
3289 static void vc_init(struct vc_data *vc, unsigned int rows, in vc_init() argument
3294 vc->vc_cols = cols; in vc_init()
3295 vc->vc_rows = rows; in vc_init()
3296 vc->vc_size_row = cols << 1; in vc_init()
3297 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; in vc_init()
3299 set_origin(vc); in vc_init()
3300 vc->vc_pos = vc->vc_origin; in vc_init()
3301 reset_vc(vc); in vc_init()
3303 vc->vc_palette[k++] = default_red[j] ; in vc_init()
3304 vc->vc_palette[k++] = default_grn[j] ; in vc_init()
3305 vc->vc_palette[k++] = default_blu[j] ; in vc_init()
3307 vc->vc_def_color = default_color; in vc_init()
3308 vc->vc_ulcolor = default_underline_color; in vc_init()
3309 vc->vc_itcolor = default_italic_color; in vc_init()
3310 vc->vc_halfcolor = 0x08; /* grey */ in vc_init()
3311 init_waitqueue_head(&vc->paste_wait); in vc_init()
3312 reset_terminal(vc, do_clear); in vc_init()
3324 struct vc_data *vc; in con_init() local
3359 vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT); in con_init()
3361 tty_port_init(&vc->port); in con_init()
3362 visual_init(vc, currcons, 1); in con_init()
3363 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); in con_init()
3364 vc_init(vc, vc->vc_rows, vc->vc_cols, in con_init()
3365 currcons || !vc->vc_sw->con_save_screen); in con_init()
3368 master_display_fg = vc = vc_cons[currcons].d; in con_init()
3369 set_origin(vc); in con_init()
3370 save_screen(vc); in con_init()
3371 gotoxy(vc, vc->vc_x, vc->vc_y); in con_init()
3372 csi_J(vc, 0); in con_init()
3373 update_screen(vc); in con_init()
3375 vc->vc_can_do_color ? "colour" : "mono", in con_init()
3376 display_desc, vc->vc_cols, vc->vc_rows); in con_init()
3512 struct vc_data *vc = vc_cons[i].d; in do_bind_con_driver() local
3519 if (!vc || !vc->vc_sw) in do_bind_con_driver()
3524 if (con_is_visible(vc)) { in do_bind_con_driver()
3526 save_screen(vc); in do_bind_con_driver()
3529 old_was_color = vc->vc_can_do_color; in do_bind_con_driver()
3530 vc->vc_sw->con_deinit(vc); in do_bind_con_driver()
3531 vc->vc_origin = (unsigned long)vc->vc_screenbuf; in do_bind_con_driver()
3532 visual_init(vc, i, 0); in do_bind_con_driver()
3533 set_origin(vc); in do_bind_con_driver()
3534 update_attr(vc); in do_bind_con_driver()
3540 if (old_was_color != vc->vc_can_do_color) in do_bind_con_driver()
3541 clear_buffer_attributes(vc); in do_bind_con_driver()
3548 struct vc_data *vc = vc_cons[j].d; in do_bind_con_driver() local
3551 vc->vc_can_do_color ? "colour" : "mono", in do_bind_con_driver()
3552 desc, vc->vc_cols, vc->vc_rows); in do_bind_con_driver()
3555 vc = vc_cons[k].d; in do_bind_con_driver()
3556 update_screen(vc); in do_bind_con_driver()
3848 bool con_is_visible(const struct vc_data *vc) in con_is_visible() argument
3852 return *vc->vc_display_fg == vc; in con_is_visible()
3868 int con_debug_enter(struct vc_data *vc) in con_debug_enter() argument
3875 saved_vc_mode = vc->vc_mode; in con_debug_enter()
3877 vc->vc_mode = KD_TEXT; in con_debug_enter()
3879 if (vc->vc_sw->con_debug_enter) in con_debug_enter()
3880 ret = vc->vc_sw->con_debug_enter(vc); in con_debug_enter()
3883 if (vc->vc_rows < 999) { in con_debug_enter()
3892 snprintf(lns, 4, "%i", vc->vc_rows); in con_debug_enter()
3896 if (vc->vc_cols < 999) { in con_debug_enter()
3905 snprintf(cols, 4, "%i", vc->vc_cols); in con_debug_enter()
3927 struct vc_data *vc; in con_debug_leave() local
3936 vc = vc_cons[fg_console].d; in con_debug_leave()
3937 if (vc->vc_sw->con_debug_leave) in con_debug_leave()
3938 ret = vc->vc_sw->con_debug_leave(vc); in con_debug_leave()
4186 struct vc_data *vc = vc_cons[fg_console].d; in do_blank_screen() local
4196 vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0); in do_blank_screen()
4203 hide_cursor(vc); in do_blank_screen()
4204 save_screen(vc); in do_blank_screen()
4205 vc->vc_sw->con_blank(vc, -1, 1); in do_blank_screen()
4208 set_origin(vc); in do_blank_screen()
4215 if (vc->vc_mode != KD_TEXT) { in do_blank_screen()
4220 hide_cursor(vc); in do_blank_screen()
4224 save_screen(vc); in do_blank_screen()
4226 i = vc->vc_sw->con_blank(vc, vesa_off_interval ? 1 : (vesa_blank_mode + 1), 0); in do_blank_screen()
4229 set_origin(vc); in do_blank_screen()
4238 vt_event_post(VT_EVENT_BLANK, vc->vc_num, vc->vc_num); in do_blank_screen()
4247 struct vc_data *vc; in do_unblank_screen() local
4267 vc = vc_cons[fg_console].d; in do_unblank_screen()
4268 if (vc->vc_mode != KD_TEXT) in do_unblank_screen()
4277 if (vc->vc_sw->con_blank(vc, 0, leaving_gfx)) in do_unblank_screen()
4279 update_screen(vc); in do_unblank_screen()
4282 set_palette(vc); in do_unblank_screen()
4283 set_cursor(vc); in do_unblank_screen()
4284 vt_event_post(VT_EVENT_UNBLANK, vc->vc_num, vc->vc_num); in do_unblank_screen()
4342 static void set_palette(struct vc_data *vc) in set_palette() argument
4346 if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_set_palette) in set_palette()
4347 vc->vc_sw->con_set_palette(vc, color_table); in set_palette()
4403 void reset_palette(struct vc_data *vc) in reset_palette() argument
4407 vc->vc_palette[k++] = default_red[j]; in reset_palette()
4408 vc->vc_palette[k++] = default_grn[j]; in reset_palette()
4409 vc->vc_palette[k++] = default_blu[j]; in reset_palette()
4411 set_palette(vc); in reset_palette()
4429 static int con_font_get(struct vc_data *vc, struct console_font_op *op) in con_font_get() argument
4443 if (vc->vc_mode != KD_TEXT) in con_font_get()
4445 else if (vc->vc_sw->con_font_get) in con_font_get()
4446 rc = vc->vc_sw->con_font_get(vc, &font); in con_font_get()
4483 static int con_font_set(struct vc_data *vc, struct console_font_op *op) in con_font_set() argument
4489 if (vc->vc_mode != KD_TEXT) in con_font_set()
4535 if (vc->vc_mode != KD_TEXT) in con_font_set()
4537 else if (vc->vc_sw->con_font_set) in con_font_set()
4538 rc = vc->vc_sw->con_font_set(vc, &font, op->flags); in con_font_set()
4546 static int con_font_default(struct vc_data *vc, struct console_font_op *op) in con_font_default() argument
4562 if (vc->vc_mode != KD_TEXT) { in con_font_default()
4566 if (vc->vc_sw->con_font_default) in con_font_default()
4567 rc = vc->vc_sw->con_font_default(vc, &font, s); in con_font_default()
4578 static int con_font_copy(struct vc_data *vc, struct console_font_op *op) in con_font_copy() argument
4585 if (vc->vc_mode != KD_TEXT) in con_font_copy()
4587 else if (!vc->vc_sw->con_font_copy) in con_font_copy()
4591 else if (con == vc->vc_num) /* nothing to do */ in con_font_copy()
4594 rc = vc->vc_sw->con_font_copy(vc, con); in con_font_copy()
4599 int con_font_op(struct vc_data *vc, struct console_font_op *op) in con_font_op() argument
4603 return con_font_set(vc, op); in con_font_op()
4605 return con_font_get(vc, op); in con_font_op()
4607 return con_font_default(vc, op); in con_font_op()
4609 return con_font_copy(vc, op); in con_font_op()
4619 u16 screen_glyph(struct vc_data *vc, int offset) in screen_glyph() argument
4621 u16 w = scr_readw(screenpos(vc, offset, 1)); in screen_glyph()
4624 if (w & vc->vc_hi_font_mask) in screen_glyph()
4630 u32 screen_glyph_unicode(struct vc_data *vc, int n) in screen_glyph_unicode() argument
4632 struct uni_screen *uniscr = get_vc_uniscr(vc); in screen_glyph_unicode()
4635 return uniscr->lines[n / vc->vc_cols][n % vc->vc_cols]; in screen_glyph_unicode()
4636 return inverse_translate(vc, screen_glyph(vc, n * 2), 1); in screen_glyph_unicode()
4641 unsigned short *screen_pos(struct vc_data *vc, int w_offset, int viewed) in screen_pos() argument
4643 return screenpos(vc, 2 * w_offset, viewed); in screen_pos()
4647 void getconsxy(struct vc_data *vc, unsigned char *p) in getconsxy() argument
4650 p[0] = min(vc->vc_x, 0xFFu); in getconsxy()
4651 p[1] = min(vc->vc_y, 0xFFu); in getconsxy()
4654 void putconsxy(struct vc_data *vc, unsigned char *p) in putconsxy() argument
4656 hide_cursor(vc); in putconsxy()
4657 gotoxy(vc, p[0], p[1]); in putconsxy()
4658 set_cursor(vc); in putconsxy()
4661 u16 vcs_scr_readw(struct vc_data *vc, const u16 *org) in vcs_scr_readw() argument
4663 if ((unsigned long)org == vc->vc_pos && softcursor_original != -1) in vcs_scr_readw()
4668 void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org) in vcs_scr_writew() argument
4671 if ((unsigned long)org == vc->vc_pos) { in vcs_scr_writew()
4673 add_softcursor(vc); in vcs_scr_writew()
4677 void vcs_scr_updated(struct vc_data *vc) in vcs_scr_updated() argument
4679 notify_update(vc); in vcs_scr_updated()