Lines Matching full:vc

137 struct vc vc_cons [MAX_NR_CONSOLES];
143 static void vc_init(struct vc_data *vc, int do_clear);
144 static void gotoxy(struct vc_data *vc, int new_x, int new_y);
145 static void save_cur(struct vc_data *vc);
146 static void reset_terminal(struct vc_data *vc, int do_clear);
149 static void set_cursor(struct vc_data *vc);
150 static void hide_cursor(struct vc_data *vc);
154 static void set_palette(struct vc_data *vc);
242 * the attribute 'active' contains the name of the current vc
243 * console and it supports poll() to detect vc switches
264 static void notify_write(struct vc_data *vc, unsigned int unicode) in notify_write() argument
266 struct vt_notifier_param param = { .vc = vc, .c = unicode }; in notify_write()
270 static void notify_update(struct vc_data *vc) in notify_update() argument
272 struct vt_notifier_param param = { .vc = vc }; in notify_update()
279 static inline bool con_is_fg(const struct vc_data *vc) in con_is_fg() argument
281 return vc->vc_num == fg_console; in con_is_fg()
284 static inline bool con_should_update(const struct vc_data *vc) in con_should_update() argument
286 return con_is_visible(vc) && !console_blanked; in con_should_update()
289 static inline u16 *screenpos(const struct vc_data *vc, unsigned int offset, in screenpos() argument
292 unsigned long origin = viewed ? vc->vc_visible_origin : vc->vc_origin; in screenpos()
297 static void con_putc(struct vc_data *vc, u16 ca, unsigned int y, unsigned int x) in con_putc() argument
299 if (vc->vc_sw->con_putc) in con_putc()
300 vc->vc_sw->con_putc(vc, ca, y, x); in con_putc()
302 vc->vc_sw->con_putcs(vc, &ca, 1, y, x); in con_putc()
357 static void vc_uniscr_set(struct vc_data *vc, u32 **new_uni_lines) in vc_uniscr_set() argument
359 vc_uniscr_free(vc->vc_uni_lines); in vc_uniscr_set()
360 vc->vc_uni_lines = new_uni_lines; in vc_uniscr_set()
363 static void vc_uniscr_putc(struct vc_data *vc, u32 uc) in vc_uniscr_putc() argument
365 if (vc->vc_uni_lines) in vc_uniscr_putc()
366 vc->vc_uni_lines[vc->state.y][vc->state.x] = uc; in vc_uniscr_putc()
369 static void vc_uniscr_insert(struct vc_data *vc, unsigned int nr) in vc_uniscr_insert() argument
371 if (vc->vc_uni_lines) { in vc_uniscr_insert()
372 u32 *ln = vc->vc_uni_lines[vc->state.y]; in vc_uniscr_insert()
373 unsigned int x = vc->state.x, cols = vc->vc_cols; in vc_uniscr_insert()
380 static void vc_uniscr_delete(struct vc_data *vc, unsigned int nr) in vc_uniscr_delete() argument
382 if (vc->vc_uni_lines) { in vc_uniscr_delete()
383 u32 *ln = vc->vc_uni_lines[vc->state.y]; in vc_uniscr_delete()
384 unsigned int x = vc->state.x, cols = vc->vc_cols; in vc_uniscr_delete()
391 static void vc_uniscr_clear_line(struct vc_data *vc, unsigned int x, in vc_uniscr_clear_line() argument
394 if (vc->vc_uni_lines) in vc_uniscr_clear_line()
395 memset32(&vc->vc_uni_lines[vc->state.y][x], ' ', nr); in vc_uniscr_clear_line()
398 static void vc_uniscr_clear_lines(struct vc_data *vc, unsigned int y, in vc_uniscr_clear_lines() argument
401 if (vc->vc_uni_lines) in vc_uniscr_clear_lines()
403 memset32(vc->vc_uni_lines[y++], ' ', vc->vc_cols); in vc_uniscr_clear_lines()
428 static void vc_uniscr_scroll(struct vc_data *vc, unsigned int top, in vc_uniscr_scroll() argument
432 u32 **uni_lines = vc->vc_uni_lines; in vc_uniscr_scroll()
440 vc_uniscr_clear_lines(vc, top, nr); in vc_uniscr_scroll()
443 vc_uniscr_clear_lines(vc, bottom - nr, nr); in vc_uniscr_scroll()
484 int vc_uniscr_check(struct vc_data *vc) in vc_uniscr_check() argument
492 if (!vc->vc_utf) in vc_uniscr_check()
495 if (vc->vc_uni_lines) in vc_uniscr_check()
498 uni_lines = vc_uniscr_alloc(vc->vc_cols, vc->vc_rows); in vc_uniscr_check()
508 p = (unsigned short *)vc->vc_origin; in vc_uniscr_check()
509 mask = vc->vc_hi_font_mask | 0xff; in vc_uniscr_check()
510 for (y = 0; y < vc->vc_rows; y++) { in vc_uniscr_check()
512 for (x = 0; x < vc->vc_cols; x++) { in vc_uniscr_check()
514 line[x] = inverse_translate(vc, glyph, true); in vc_uniscr_check()
518 vc->vc_uni_lines = uni_lines; in vc_uniscr_check()
528 void vc_uniscr_copy_line(const struct vc_data *vc, void *dest, bool viewed, in vc_uniscr_copy_line() argument
531 u32 **uni_lines = vc->vc_uni_lines; in vc_uniscr_copy_line()
532 int offset = row * vc->vc_size_row + col * 2; in vc_uniscr_copy_line()
538 pos = (unsigned long)screenpos(vc, offset, viewed); in vc_uniscr_copy_line()
539 if (pos >= vc->vc_origin && pos < vc->vc_scr_end) { in vc_uniscr_copy_line()
545 row = (pos - vc->vc_origin) / vc->vc_size_row; in vc_uniscr_copy_line()
546 col = ((pos - vc->vc_origin) % vc->vc_size_row) / 2; in vc_uniscr_copy_line()
556 int mask = vc->vc_hi_font_mask | 0xff; in vc_uniscr_copy_line()
560 *uni_buf++ = inverse_translate(vc, glyph, true); in vc_uniscr_copy_line()
565 static void con_scroll(struct vc_data *vc, unsigned int top, in con_scroll() argument
574 if (bottom > vc->vc_rows || top >= bottom || nr < 1) in con_scroll()
577 vc_uniscr_scroll(vc, top, bottom, dir, nr); in con_scroll()
578 if (con_is_visible(vc) && in con_scroll()
579 vc->vc_sw->con_scroll(vc, top, bottom, dir, nr)) in con_scroll()
582 src = clear = (u16 *)(vc->vc_origin + vc->vc_size_row * top); in con_scroll()
583 dst = (u16 *)(vc->vc_origin + vc->vc_size_row * (top + nr)); in con_scroll()
586 clear = src + (rows - nr) * vc->vc_cols; in con_scroll()
589 scr_memmovew(dst, src, (rows - nr) * vc->vc_size_row); in con_scroll()
590 scr_memsetw(clear, vc->vc_video_erase_char, vc->vc_size_row * nr); in con_scroll()
593 static void do_update_region(struct vc_data *vc, unsigned long start, int count) in do_update_region() argument
598 offset = (start - vc->vc_origin) / 2; in do_update_region()
599 xx = offset % vc->vc_cols; in do_update_region()
600 yy = offset / vc->vc_cols; in do_update_region()
606 while (xx < vc->vc_cols && count) { in do_update_region()
609 vc->vc_sw->con_putcs(vc, q, p-q, yy, startx); in do_update_region()
619 vc->vc_sw->con_putcs(vc, q, p-q, yy, startx); in do_update_region()
627 void update_region(struct vc_data *vc, unsigned long start, int count) in update_region() argument
631 if (con_should_update(vc)) { in update_region()
632 hide_cursor(vc); in update_region()
633 do_update_region(vc, start, count); in update_region()
634 set_cursor(vc); in update_region()
641 static u8 build_attr(struct vc_data *vc, u8 _color, in build_attr() argument
645 if (vc->vc_sw->con_build_attr) in build_attr()
646 return vc->vc_sw->con_build_attr(vc, _color, _intensity, in build_attr()
661 if (!vc->vc_can_do_color) in build_attr()
668 a = (a & 0xF0) | vc->vc_itcolor; in build_attr()
670 a = (a & 0xf0) | vc->vc_ulcolor; in build_attr()
672 a = (a & 0xf0) | vc->vc_halfcolor; in build_attr()
679 if (vc->vc_hi_font_mask == 0x100) in build_attr()
685 static void update_attr(struct vc_data *vc) in update_attr() argument
687 vc->vc_attr = build_attr(vc, vc->state.color, vc->state.intensity, in update_attr()
688 vc->state.blink, vc->state.underline, in update_attr()
689 vc->state.reverse ^ vc->vc_decscnm, vc->state.italic); in update_attr()
690 vc->vc_video_erase_char = ' ' | (build_attr(vc, vc->state.color, in update_attr()
691 VCI_NORMAL, vc->state.blink, false, in update_attr()
692 vc->vc_decscnm, false) << 8); in update_attr()
696 void invert_screen(struct vc_data *vc, int offset, int count, bool viewed) in invert_screen() argument
703 p = screenpos(vc, offset, viewed); in invert_screen()
704 if (vc->vc_sw->con_invert_region) { in invert_screen()
705 vc->vc_sw->con_invert_region(vc, p, count); in invert_screen()
711 if (!vc->vc_can_do_color) { in invert_screen()
718 } else if (vc->vc_hi_font_mask == 0x100) { in invert_screen()
739 if (con_should_update(vc)) in invert_screen()
740 do_update_region(vc, (unsigned long) p, count); in invert_screen()
741 notify_update(vc); in invert_screen()
745 void complement_pos(struct vc_data *vc, int offset) in complement_pos() argument
754 old_offset < vc->vc_screenbuf_size) { in complement_pos()
755 scr_writew(old, screenpos(vc, old_offset, true)); in complement_pos()
756 if (con_should_update(vc)) in complement_pos()
757 con_putc(vc, old, oldy, oldx); in complement_pos()
758 notify_update(vc); in complement_pos()
764 offset < vc->vc_screenbuf_size) { in complement_pos()
766 u16 *p = screenpos(vc, offset, true); in complement_pos()
768 new = old ^ vc->vc_complement_mask; in complement_pos()
770 if (con_should_update(vc)) { in complement_pos()
771 oldx = (offset >> 1) % vc->vc_cols; in complement_pos()
772 oldy = (offset >> 1) / vc->vc_cols; in complement_pos()
773 con_putc(vc, new, oldy, oldx); in complement_pos()
775 notify_update(vc); in complement_pos()
779 static void insert_char(struct vc_data *vc, unsigned int nr) in insert_char() argument
781 unsigned short *p = (unsigned short *) vc->vc_pos; in insert_char()
783 vc_uniscr_insert(vc, nr); in insert_char()
784 scr_memmovew(p + nr, p, (vc->vc_cols - vc->state.x - nr) * 2); in insert_char()
785 scr_memsetw(p, vc->vc_video_erase_char, nr * 2); in insert_char()
786 vc->vc_need_wrap = 0; in insert_char()
787 if (con_should_update(vc)) in insert_char()
788 do_update_region(vc, (unsigned long) p, in insert_char()
789 vc->vc_cols - vc->state.x); in insert_char()
792 static void delete_char(struct vc_data *vc, unsigned int nr) in delete_char() argument
794 unsigned short *p = (unsigned short *) vc->vc_pos; in delete_char()
796 vc_uniscr_delete(vc, nr); in delete_char()
797 scr_memmovew(p, p + nr, (vc->vc_cols - vc->state.x - nr) * 2); in delete_char()
798 scr_memsetw(p + vc->vc_cols - vc->state.x - nr, vc->vc_video_erase_char, in delete_char()
800 vc->vc_need_wrap = 0; in delete_char()
801 if (con_should_update(vc)) in delete_char()
802 do_update_region(vc, (unsigned long) p, in delete_char()
803 vc->vc_cols - vc->state.x); in delete_char()
808 static void add_softcursor(struct vc_data *vc) in add_softcursor() argument
810 int i = scr_readw((u16 *) vc->vc_pos); in add_softcursor()
811 u32 type = vc->vc_cursor_type; in add_softcursor()
825 scr_writew(i, (u16 *)vc->vc_pos); in add_softcursor()
826 if (con_should_update(vc)) in add_softcursor()
827 con_putc(vc, i, vc->state.y, vc->state.x); in add_softcursor()
830 static void hide_softcursor(struct vc_data *vc) in hide_softcursor() argument
833 scr_writew(softcursor_original, (u16 *)vc->vc_pos); in hide_softcursor()
834 if (con_should_update(vc)) in hide_softcursor()
835 con_putc(vc, softcursor_original, vc->state.y, in hide_softcursor()
836 vc->state.x); in hide_softcursor()
841 static void hide_cursor(struct vc_data *vc) in hide_cursor() argument
843 if (vc_is_sel(vc)) in hide_cursor()
846 vc->vc_sw->con_cursor(vc, false); in hide_cursor()
847 hide_softcursor(vc); in hide_cursor()
850 static void set_cursor(struct vc_data *vc) in set_cursor() argument
852 if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS) in set_cursor()
854 if (vc->vc_deccm) { in set_cursor()
855 if (vc_is_sel(vc)) in set_cursor()
857 add_softcursor(vc); in set_cursor()
858 if (CUR_SIZE(vc->vc_cursor_type) != CUR_NONE) in set_cursor()
859 vc->vc_sw->con_cursor(vc, true); in set_cursor()
861 hide_cursor(vc); in set_cursor()
864 static void set_origin(struct vc_data *vc) in set_origin() argument
868 if (!con_is_visible(vc) || in set_origin()
869 !vc->vc_sw->con_set_origin || in set_origin()
870 !vc->vc_sw->con_set_origin(vc)) in set_origin()
871 vc->vc_origin = (unsigned long)vc->vc_screenbuf; in set_origin()
872 vc->vc_visible_origin = vc->vc_origin; in set_origin()
873 vc->vc_scr_end = vc->vc_origin + vc->vc_screenbuf_size; in set_origin()
874 vc->vc_pos = vc->vc_origin + vc->vc_size_row * vc->state.y + in set_origin()
875 2 * vc->state.x; in set_origin()
878 static void save_screen(struct vc_data *vc) in save_screen() argument
882 if (vc->vc_sw->con_save_screen) in save_screen()
883 vc->vc_sw->con_save_screen(vc); in save_screen()
886 static void flush_scrollback(struct vc_data *vc) in flush_scrollback() argument
890 set_origin(vc); in flush_scrollback()
891 if (!con_is_visible(vc)) in flush_scrollback()
900 hide_cursor(vc); in flush_scrollback()
901 vc->vc_sw->con_switch(vc); in flush_scrollback()
902 set_cursor(vc); in flush_scrollback()
909 void clear_buffer_attributes(struct vc_data *vc) in clear_buffer_attributes() argument
911 unsigned short *p = (unsigned short *)vc->vc_origin; in clear_buffer_attributes()
912 int count = vc->vc_screenbuf_size / 2; in clear_buffer_attributes()
913 int mask = vc->vc_hi_font_mask | 0xff; in clear_buffer_attributes()
916 scr_writew((scr_readw(p)&mask) | (vc->vc_video_erase_char & ~mask), p); in clear_buffer_attributes()
920 void redraw_screen(struct vc_data *vc, int is_switch) in redraw_screen() argument
926 if (!vc) { in redraw_screen()
934 if (old_vc == vc) in redraw_screen()
936 if (!con_is_visible(vc)) in redraw_screen()
938 *vc->vc_display_fg = vc; in redraw_screen()
939 fg_console = vc->vc_num; in redraw_screen()
948 hide_cursor(vc); in redraw_screen()
954 int old_was_color = vc->vc_can_do_color; in redraw_screen()
956 set_origin(vc); in redraw_screen()
957 update = vc->vc_sw->con_switch(vc); in redraw_screen()
958 set_palette(vc); in redraw_screen()
965 if (old_was_color != vc->vc_can_do_color) { in redraw_screen()
966 update_attr(vc); in redraw_screen()
967 clear_buffer_attributes(vc); in redraw_screen()
970 if (update && vc->vc_mode != KD_GRAPHICS) in redraw_screen()
971 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); in redraw_screen()
973 set_cursor(vc); in redraw_screen()
976 notify_update(vc); in redraw_screen()
990 static void visual_init(struct vc_data *vc, int num, bool init) in visual_init() argument
992 /* ++Geert: vc->vc_sw->con_init determines console size */ in visual_init()
993 if (vc->vc_sw) in visual_init()
994 module_put(vc->vc_sw->owner); in visual_init()
995 vc->vc_sw = conswitchp; in visual_init()
998 vc->vc_sw = con_driver_map[num]; in visual_init()
1000 __module_get(vc->vc_sw->owner); in visual_init()
1001 vc->vc_num = num; in visual_init()
1002 vc->vc_display_fg = &master_display_fg; in visual_init()
1003 if (vc->uni_pagedict_loc) in visual_init()
1004 con_free_unimap(vc); in visual_init()
1005 vc->uni_pagedict_loc = &vc->uni_pagedict; in visual_init()
1006 vc->uni_pagedict = NULL; in visual_init()
1007 vc->vc_hi_font_mask = 0; in visual_init()
1008 vc->vc_complement_mask = 0; in visual_init()
1009 vc->vc_can_do_color = 0; in visual_init()
1010 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in visual_init()
1011 vc->vc_sw->con_init(vc, init); in visual_init()
1012 if (!vc->vc_complement_mask) in visual_init()
1013 vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800; in visual_init()
1014 vc->vc_s_complement_mask = vc->vc_complement_mask; in visual_init()
1015 vc->vc_size_row = vc->vc_cols << 1; in visual_init()
1016 vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row; in visual_init()
1020 static void visual_deinit(struct vc_data *vc) in visual_deinit() argument
1022 vc->vc_sw->con_deinit(vc); in visual_deinit()
1023 module_put(vc->vc_sw->owner); in visual_deinit()
1028 struct vc_data *vc = container_of(port, struct vc_data, port); in vc_port_destruct() local
1030 kfree(vc); in vc_port_destruct()
1048 struct vc_data *vc; in vc_allocate() local
1065 param.vc = vc = kzalloc(sizeof(struct vc_data), GFP_KERNEL); in vc_allocate()
1066 if (!vc) in vc_allocate()
1069 vc_cons[currcons].d = vc; in vc_allocate()
1070 tty_port_init(&vc->port); in vc_allocate()
1071 vc->port.ops = &vc_port_ops; in vc_allocate()
1074 visual_init(vc, currcons, true); in vc_allocate()
1076 if (!*vc->uni_pagedict_loc) in vc_allocate()
1077 con_set_default_unimap(vc); in vc_allocate()
1080 if (vc->vc_cols > VC_MAXCOL || vc->vc_rows > VC_MAXROW || in vc_allocate()
1081 vc->vc_screenbuf_size > KMALLOC_MAX_SIZE || !vc->vc_screenbuf_size) in vc_allocate()
1084 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL); in vc_allocate()
1085 if (!vc->vc_screenbuf) in vc_allocate()
1093 vc_init(vc, 1); in vc_allocate()
1099 visual_deinit(vc); in vc_allocate()
1100 kfree(vc); in vc_allocate()
1105 static inline int resize_screen(struct vc_data *vc, int width, int height, in resize_screen() argument
1111 if (vc->vc_sw->con_resize) in resize_screen()
1112 err = vc->vc_sw->con_resize(vc, width, height, from_user); in resize_screen()
1120 * @vc: virtual console private data
1132 static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, in vc_do_resize() argument
1147 new_cols = (cols ? cols : vc->vc_cols); in vc_do_resize()
1148 new_rows = (lines ? lines : vc->vc_rows); in vc_do_resize()
1152 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) { in vc_do_resize()
1169 return resize_screen(vc, new_cols, new_rows, from_user); in vc_do_resize()
1178 if (vc->vc_uni_lines) { in vc_do_resize()
1186 if (vc_is_sel(vc)) in vc_do_resize()
1189 old_rows = vc->vc_rows; in vc_do_resize()
1190 old_row_size = vc->vc_size_row; in vc_do_resize()
1192 err = resize_screen(vc, new_cols, new_rows, from_user); in vc_do_resize()
1199 vc->vc_rows = new_rows; in vc_do_resize()
1200 vc->vc_cols = new_cols; in vc_do_resize()
1201 vc->vc_size_row = new_row_size; in vc_do_resize()
1202 vc->vc_screenbuf_size = new_screen_size; in vc_do_resize()
1206 old_origin = vc->vc_origin; in vc_do_resize()
1210 if (vc->state.y > new_rows) { in vc_do_resize()
1211 if (old_rows - vc->state.y < new_rows) { in vc_do_resize()
1222 first_copied_row = (vc->state.y - new_rows/2); in vc_do_resize()
1230 vc->vc_uni_lines, rlth/2, first_copied_row, in vc_do_resize()
1232 vc_uniscr_set(vc, new_uniscr); in vc_do_resize()
1234 update_attr(vc); in vc_do_resize()
1241 vc->vc_video_erase_char, rrem); in vc_do_resize()
1246 scr_memsetw((void *)new_origin, vc->vc_video_erase_char, in vc_do_resize()
1248 oldscreen = vc->vc_screenbuf; in vc_do_resize()
1249 vc->vc_screenbuf = newscreen; in vc_do_resize()
1250 vc->vc_screenbuf_size = new_screen_size; in vc_do_resize()
1251 set_origin(vc); in vc_do_resize()
1255 vc->vc_top = 0; in vc_do_resize()
1256 vc->vc_bottom = vc->vc_rows; in vc_do_resize()
1257 gotoxy(vc, vc->state.x, vc->state.y); in vc_do_resize()
1258 save_cur(vc); in vc_do_resize()
1265 ws.ws_row = vc->vc_rows; in vc_do_resize()
1266 ws.ws_col = vc->vc_cols; in vc_do_resize()
1267 ws.ws_ypixel = vc->vc_scan_lines; in vc_do_resize()
1271 if (con_is_visible(vc)) in vc_do_resize()
1272 update_screen(vc); in vc_do_resize()
1273 vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); in vc_do_resize()
1274 notify_update(vc); in vc_do_resize()
1280 * @vc: virtual console
1289 * and @vc->port.tty.
1291 int __vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows, in __vc_resize() argument
1294 return vc_do_resize(vc->port.tty, vc, cols, rows, from_user); in __vc_resize()
1311 struct vc_data *vc = tty->driver_data; in vt_resize() local
1315 ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row, false); in vt_resize()
1322 struct vc_data *vc = NULL; in vc_deallocate() local
1329 param.vc = vc = vc_cons[currcons].d; in vc_deallocate()
1332 visual_deinit(vc); in vc_deallocate()
1333 con_free_unimap(vc); in vc_deallocate()
1334 put_pid(vc->vt_pid); in vc_deallocate()
1335 vc_uniscr_set(vc, NULL); in vc_deallocate()
1336 kfree(vc->vc_screenbuf); in vc_deallocate()
1339 return vc; in vc_deallocate()
1348 #define set_kbd(vc, x) vt_set_kbd_mode_bit((vc)->vc_num, (x)) argument
1349 #define clr_kbd(vc, x) vt_clr_kbd_mode_bit((vc)->vc_num, (x)) argument
1350 #define is_kbd(vc, x) vt_get_kbd_mode_bit((vc)->vc_num, (x)) argument
1388 static void gotoxy(struct vc_data *vc, int new_x, int new_y) in gotoxy() argument
1393 vc->state.x = 0; in gotoxy()
1395 if (new_x >= vc->vc_cols) in gotoxy()
1396 vc->state.x = vc->vc_cols - 1; in gotoxy()
1398 vc->state.x = new_x; in gotoxy()
1401 if (vc->vc_decom) { in gotoxy()
1402 min_y = vc->vc_top; in gotoxy()
1403 max_y = vc->vc_bottom; in gotoxy()
1406 max_y = vc->vc_rows; in gotoxy()
1409 vc->state.y = min_y; in gotoxy()
1411 vc->state.y = max_y - 1; in gotoxy()
1413 vc->state.y = new_y; in gotoxy()
1414 vc->vc_pos = vc->vc_origin + vc->state.y * vc->vc_size_row + in gotoxy()
1415 (vc->state.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->state.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->state.y < vc->vc_rows - 1) { in lf()
1445 vc->state.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->state.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->state.y > 0) { in ri()
1460 vc->state.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->state.x << 1; in cr()
1469 vc->vc_need_wrap = vc->state.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->state.x) { in bs()
1476 vc->vc_pos -= 2; in bs()
1477 vc->state.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
1495 static void csi_J(struct vc_data *vc, enum CSI_J vpar) in csi_J() argument
1502 vc_uniscr_clear_line(vc, vc->state.x, in csi_J()
1503 vc->vc_cols - vc->state.x); in csi_J()
1504 vc_uniscr_clear_lines(vc, vc->state.y + 1, in csi_J()
1505 vc->vc_rows - vc->state.y - 1); in csi_J()
1506 count = (vc->vc_scr_end - vc->vc_pos) >> 1; in csi_J()
1507 start = (unsigned short *)vc->vc_pos; in csi_J()
1510 vc_uniscr_clear_line(vc, 0, vc->state.x + 1); in csi_J()
1511 vc_uniscr_clear_lines(vc, 0, vc->state.y); in csi_J()
1512 count = ((vc->vc_pos - vc->vc_origin) >> 1) + 1; in csi_J()
1513 start = (unsigned short *)vc->vc_origin; in csi_J()
1516 flush_scrollback(vc); in csi_J()
1519 vc_uniscr_clear_lines(vc, 0, vc->vc_rows); in csi_J()
1520 count = vc->vc_cols * vc->vc_rows; in csi_J()
1521 start = (unsigned short *)vc->vc_origin; in csi_J()
1526 scr_memsetw(start, vc->vc_video_erase_char, 2 * count); in csi_J()
1527 if (con_should_update(vc)) in csi_J()
1528 do_update_region(vc, (unsigned long) start, count); in csi_J()
1529 vc->vc_need_wrap = 0; in csi_J()
1538 static void csi_K(struct vc_data *vc) in csi_K() argument
1541 unsigned short *start = (unsigned short *)vc->vc_pos; in csi_K()
1544 switch (vc->vc_par[0]) { in csi_K()
1547 count = vc->vc_cols - vc->state.x; in csi_K()
1550 offset = -vc->state.x; in csi_K()
1551 count = vc->state.x + 1; in csi_K()
1554 offset = -vc->state.x; in csi_K()
1555 count = vc->vc_cols; in csi_K()
1560 vc_uniscr_clear_line(vc, vc->state.x + offset, count); in csi_K()
1561 scr_memsetw(start + offset, vc->vc_video_erase_char, 2 * count); in csi_K()
1562 vc->vc_need_wrap = 0; in csi_K()
1563 if (con_should_update(vc)) in csi_K()
1564 do_update_region(vc, (unsigned long)(start + offset), count); in csi_K()
1568 static void csi_X(struct vc_data *vc) in csi_X() argument
1570 unsigned int count = clamp(vc->vc_par[0], 1, vc->vc_cols - vc->state.x); in csi_X()
1572 vc_uniscr_clear_line(vc, vc->state.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->state.y, vc->state.x, 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->state.intensity = VCI_NORMAL; in default_attr()
1582 vc->state.italic = false; in default_attr()
1583 vc->state.underline = false; in default_attr()
1584 vc->state.reverse = false; in default_attr()
1585 vc->state.blink = false; in default_attr()
1586 vc->state.color = vc->vc_def_color; in default_attr()
1612 static void rgb_foreground(struct vc_data *vc, const struct rgb *c) in rgb_foreground() argument
1625 vc->state.intensity = VCI_BOLD; in rgb_foreground()
1627 vc->state.intensity = VCI_BOLD; in rgb_foreground()
1629 vc->state.intensity = VCI_NORMAL; in rgb_foreground()
1631 vc->state.color = (vc->state.color & 0xf0) | hue; in rgb_foreground()
1634 static void rgb_background(struct vc_data *vc, const struct rgb *c) in rgb_background() argument
1637 vc->state.color = (vc->state.color & 0x0f) in rgb_background()
1650 static int vc_t416_color(struct vc_data *vc, int i, in vc_t416_color() argument
1651 void(*set_color)(struct vc_data *vc, const struct rgb *c)) in vc_t416_color() argument
1656 if (i > vc->vc_npar) in vc_t416_color()
1659 if (vc->vc_par[i] == 5 && i + 1 <= vc->vc_npar) { in vc_t416_color()
1662 rgb_from_256(vc->vc_par[i], &c); in vc_t416_color()
1663 } else if (vc->vc_par[i] == 2 && i + 3 <= vc->vc_npar) { in vc_t416_color()
1665 c.r = vc->vc_par[i + 1]; in vc_t416_color()
1666 c.g = vc->vc_par[i + 2]; in vc_t416_color()
1667 c.b = vc->vc_par[i + 3]; in vc_t416_color()
1672 set_color(vc, &c); in vc_t416_color()
1711 static void csi_m(struct vc_data *vc) in csi_m() argument
1715 for (i = 0; i <= vc->vc_npar; i++) in csi_m()
1716 switch (vc->vc_par[i]) { in csi_m()
1718 default_attr(vc); in csi_m()
1721 vc->state.intensity = VCI_BOLD; in csi_m()
1724 vc->state.intensity = VCI_HALF_BRIGHT; in csi_m()
1727 vc->state.italic = true; in csi_m()
1735 vc->state.underline = true; in csi_m()
1738 vc->state.blink = true; in csi_m()
1741 vc->state.reverse = true; in csi_m()
1747 vc->vc_translate = set_translate(vc->state.Gx_charset[vc->state.charset], vc); in csi_m()
1748 vc->vc_disp_ctrl = 0; in csi_m()
1749 vc->vc_toggle_meta = 0; in csi_m()
1755 vc->vc_translate = set_translate(IBMPC_MAP, vc); in csi_m()
1756 vc->vc_disp_ctrl = 1; in csi_m()
1757 vc->vc_toggle_meta = 0; in csi_m()
1763 vc->vc_translate = set_translate(IBMPC_MAP, vc); in csi_m()
1764 vc->vc_disp_ctrl = 1; in csi_m()
1765 vc->vc_toggle_meta = 1; in csi_m()
1768 vc->state.intensity = VCI_NORMAL; in csi_m()
1771 vc->state.italic = false; in csi_m()
1774 vc->state.underline = false; in csi_m()
1777 vc->state.blink = false; in csi_m()
1780 vc->state.reverse = false; in csi_m()
1783 i = vc_t416_color(vc, i, rgb_foreground); in csi_m()
1786 i = vc_t416_color(vc, i, rgb_background); in csi_m()
1789 vc->state.color = (vc->vc_def_color & 0x0f) | in csi_m()
1790 (vc->state.color & 0xf0); in csi_m()
1793 vc->state.color = (vc->vc_def_color & 0xf0) | in csi_m()
1794 (vc->state.color & 0x0f); in csi_m()
1797 vc->state.intensity = VCI_BOLD; in csi_m()
1798 vc->vc_par[i] -= CSI_m_BRIGHT_FG_COLOR_OFF; in csi_m()
1801 vc->vc_par[i] -= CSI_m_FG_COLOR_BEG; in csi_m()
1802 vc->state.color = color_table[vc->vc_par[i]] | in csi_m()
1803 (vc->state.color & 0xf0); in csi_m()
1806 vc->vc_par[i] -= CSI_m_BRIGHT_BG_COLOR_OFF; in csi_m()
1809 vc->vc_par[i] -= CSI_m_BG_COLOR_BEG; in csi_m()
1810 vc->state.color = (color_table[vc->vc_par[i]] << 4) | in csi_m()
1811 (vc->state.color & 0x0f); in csi_m()
1814 update_attr(vc); in csi_m()
1823 static void cursor_report(struct vc_data *vc, struct tty_struct *tty) in cursor_report() argument
1828 len = sprintf(buf, "\033[%d;%dR", vc->state.y + in cursor_report()
1829 (vc->vc_decom ? vc->vc_top + 1 : 1), in cursor_report()
1830 vc->state.x + 1); in cursor_report()
1878 static void csi_DEC_hl(struct vc_data *vc, bool on_off) in csi_DEC_hl() argument
1882 for (i = 0; i <= vc->vc_npar; i++) in csi_DEC_hl()
1883 switch (vc->vc_par[i]) { in csi_DEC_hl()
1886 set_kbd(vc, decckm); in csi_DEC_hl()
1888 clr_kbd(vc, decckm); in csi_DEC_hl()
1892 vc_resize(deccolm ? 132 : 80, vc->vc_rows); in csi_DEC_hl()
1898 if (vc->vc_decscnm != on_off) { in csi_DEC_hl()
1899 vc->vc_decscnm = on_off; in csi_DEC_hl()
1900 invert_screen(vc, 0, vc->vc_screenbuf_size, in csi_DEC_hl()
1902 update_attr(vc); in csi_DEC_hl()
1906 vc->vc_decom = on_off; in csi_DEC_hl()
1907 gotoxay(vc, 0, 0); in csi_DEC_hl()
1910 vc->vc_decawm = on_off; in csi_DEC_hl()
1914 set_kbd(vc, decarm); in csi_DEC_hl()
1916 clr_kbd(vc, decarm); in csi_DEC_hl()
1919 vc->vc_report_mouse = on_off ? 1 : 0; in csi_DEC_hl()
1922 vc->vc_deccm = on_off; in csi_DEC_hl()
1925 vc->vc_report_mouse = on_off ? 2 : 0; in csi_DEC_hl()
1937 static void csi_hl(struct vc_data *vc, bool on_off) in csi_hl() argument
1941 for (i = 0; i <= vc->vc_npar; i++) in csi_hl()
1942 switch (vc->vc_par[i]) { /* ANSI modes set/reset */ in csi_hl()
1944 vc->vc_disp_ctrl = on_off; in csi_hl()
1947 vc->vc_decim = on_off; in csi_hl()
1951 set_kbd(vc, lnm); in csi_hl()
1953 clr_kbd(vc, lnm); in csi_hl()
1979 static void csi_RSB(struct vc_data *vc) in csi_RSB() argument
1981 switch (vc->vc_par[0]) { in csi_RSB()
1983 if (vc->vc_can_do_color && vc->vc_par[1] < 16) { in csi_RSB()
1984 vc->vc_ulcolor = color_table[vc->vc_par[1]]; in csi_RSB()
1985 if (vc->state.underline) in csi_RSB()
1986 update_attr(vc); in csi_RSB()
1990 if (vc->vc_can_do_color && vc->vc_par[1] < 16) { in csi_RSB()
1991 vc->vc_halfcolor = color_table[vc->vc_par[1]]; in csi_RSB()
1992 if (vc->state.intensity == VCI_HALF_BRIGHT) in csi_RSB()
1993 update_attr(vc); in csi_RSB()
1997 vc->vc_def_color = vc->vc_attr; in csi_RSB()
1998 if (vc->vc_hi_font_mask == 0x100) in csi_RSB()
1999 vc->vc_def_color >>= 1; in csi_RSB()
2000 default_attr(vc); in csi_RSB()
2001 update_attr(vc); in csi_RSB()
2004 blankinterval = min(vc->vc_par[1], 60U) * 60; in csi_RSB()
2008 if (vc->vc_npar >= 1) in csi_RSB()
2009 vc->vc_bell_pitch = vc->vc_par[1]; in csi_RSB()
2011 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; in csi_RSB()
2014 if (vc->vc_npar >= 1) in csi_RSB()
2015 vc->vc_bell_duration = (vc->vc_par[1] < 2000) ? in csi_RSB()
2016 msecs_to_jiffies(vc->vc_par[1]) : 0; in csi_RSB()
2018 vc->vc_bell_duration = DEFAULT_BELL_DURATION; in csi_RSB()
2021 if (vc->vc_par[1] >= 1 && vc_cons_allocated(vc->vc_par[1] - 1)) in csi_RSB()
2022 set_console(vc->vc_par[1] - 1); in csi_RSB()
2028 vesa_off_interval = min(vc->vc_par[1], 60U) * 60 * HZ; in csi_RSB()
2034 if (vc->vc_npar >= 1 && vc->vc_par[1] >= 50 && in csi_RSB()
2035 vc->vc_par[1] <= USHRT_MAX) in csi_RSB()
2036 vc->vc_cur_blink_ms = vc->vc_par[1]; in csi_RSB()
2038 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in csi_RSB()
2044 static void csi_at(struct vc_data *vc, unsigned int nr) in csi_at() argument
2046 nr = clamp(nr, 1, vc->vc_cols - vc->state.x); in csi_at()
2047 insert_char(vc, nr); in csi_at()
2051 static void csi_L(struct vc_data *vc) in csi_L() argument
2053 unsigned int nr = clamp(vc->vc_par[0], 1, vc->vc_rows - vc->state.y); in csi_L()
2055 con_scroll(vc, vc->state.y, vc->vc_bottom, SM_DOWN, nr); in csi_L()
2056 vc->vc_need_wrap = 0; in csi_L()
2060 static void csi_P(struct vc_data *vc) in csi_P() argument
2062 unsigned int nr = clamp(vc->vc_par[0], 1, vc->vc_cols - vc->state.x); in csi_P()
2064 delete_char(vc, nr); in csi_P()
2068 static void csi_M(struct vc_data *vc) in csi_M() argument
2070 unsigned int nr = clamp(vc->vc_par[0], 1, vc->vc_rows - vc->state.y); in csi_M()
2072 con_scroll(vc, vc->state.y, vc->vc_bottom, SM_UP, nr); in csi_M()
2073 vc->vc_need_wrap = 0; in csi_M()
2077 static void save_cur(struct vc_data *vc) in save_cur() argument
2079 memcpy(&vc->saved_state, &vc->state, sizeof(vc->state)); in save_cur()
2083 static void restore_cur(struct vc_data *vc) in restore_cur() argument
2085 memcpy(&vc->state, &vc->saved_state, sizeof(vc->state)); in restore_cur()
2087 gotoxy(vc, vc->state.x, vc->state.y); in restore_cur()
2088 vc->vc_translate = set_translate(vc->state.Gx_charset[vc->state.charset], in restore_cur()
2089 vc); in restore_cur()
2090 update_attr(vc); in restore_cur()
2091 vc->vc_need_wrap = 0; in restore_cur()
2138 static void reset_terminal(struct vc_data *vc, int do_clear) in reset_terminal() argument
2142 vc->vc_top = 0; in reset_terminal()
2143 vc->vc_bottom = vc->vc_rows; in reset_terminal()
2144 vc->vc_state = ESnormal; in reset_terminal()
2145 vc->vc_priv = EPecma; in reset_terminal()
2146 vc->vc_translate = set_translate(LAT1_MAP, vc); in reset_terminal()
2147 vc->state.Gx_charset[0] = LAT1_MAP; in reset_terminal()
2148 vc->state.Gx_charset[1] = GRAF_MAP; in reset_terminal()
2149 vc->state.charset = 0; in reset_terminal()
2150 vc->vc_need_wrap = 0; in reset_terminal()
2151 vc->vc_report_mouse = 0; in reset_terminal()
2152 vc->vc_utf = default_utf8; in reset_terminal()
2153 vc->vc_utf_count = 0; in reset_terminal()
2155 vc->vc_disp_ctrl = 0; in reset_terminal()
2156 vc->vc_toggle_meta = 0; in reset_terminal()
2158 vc->vc_decscnm = 0; in reset_terminal()
2159 vc->vc_decom = 0; in reset_terminal()
2160 vc->vc_decawm = 1; in reset_terminal()
2161 vc->vc_deccm = global_cursor_default; in reset_terminal()
2162 vc->vc_decim = 0; in reset_terminal()
2164 vt_reset_keyboard(vc->vc_num); in reset_terminal()
2166 vc->vc_cursor_type = cur_default; in reset_terminal()
2167 vc->vc_complement_mask = vc->vc_s_complement_mask; in reset_terminal()
2169 default_attr(vc); in reset_terminal()
2170 update_attr(vc); in reset_terminal()
2172 bitmap_zero(vc->vc_tab_stop, VC_TABSTOPS_COUNT); in reset_terminal()
2174 set_bit(i, vc->vc_tab_stop); in reset_terminal()
2176 vc->vc_bell_pitch = DEFAULT_BELL_PITCH; in reset_terminal()
2177 vc->vc_bell_duration = DEFAULT_BELL_DURATION; in reset_terminal()
2178 vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS; in reset_terminal()
2180 gotoxy(vc, 0, 0); in reset_terminal()
2181 save_cur(vc); in reset_terminal()
2183 csi_J(vc, CSI_J_VISIBLE); in reset_terminal()
2186 static void vc_setGx(struct vc_data *vc, unsigned int which, u8 c) in vc_setGx() argument
2188 unsigned char *charset = &vc->state.Gx_charset[which]; in vc_setGx()
2205 if (vc->state.charset == which) in vc_setGx()
2206 vc->vc_translate = set_translate(*charset, vc); in vc_setGx()
2238 * E.g. ESC sets the state of vc to ESesc.
2242 static bool handle_ascii(struct tty_struct *tty, struct vc_data *vc, u8 c) in handle_ascii() argument
2248 if (ansi_control_string(vc->vc_state)) in handle_ascii()
2249 vc->vc_state = ESnormal; in handle_ascii()
2250 else if (vc->vc_bell_duration) in handle_ascii()
2251 kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration); in handle_ascii()
2254 bs(vc); in handle_ascii()
2257 vc->vc_pos -= (vc->state.x << 1); in handle_ascii()
2259 vc->state.x = find_next_bit(vc->vc_tab_stop, in handle_ascii()
2260 min(vc->vc_cols - 1, VC_TABSTOPS_COUNT), in handle_ascii()
2261 vc->state.x + 1); in handle_ascii()
2262 if (vc->state.x >= VC_TABSTOPS_COUNT) in handle_ascii()
2263 vc->state.x = vc->vc_cols - 1; in handle_ascii()
2265 vc->vc_pos += (vc->state.x << 1); in handle_ascii()
2266 notify_write(vc, '\t'); in handle_ascii()
2271 lf(vc); in handle_ascii()
2272 if (!is_kbd(vc, lnm)) in handle_ascii()
2276 cr(vc); in handle_ascii()
2279 vc->state.charset = 1; in handle_ascii()
2280 vc->vc_translate = set_translate(vc->state.Gx_charset[1], vc); in handle_ascii()
2281 vc->vc_disp_ctrl = 1; in handle_ascii()
2284 vc->state.charset = 0; in handle_ascii()
2285 vc->vc_translate = set_translate(vc->state.Gx_charset[0], vc); in handle_ascii()
2286 vc->vc_disp_ctrl = 0; in handle_ascii()
2290 vc->vc_state = ESnormal; in handle_ascii()
2293 vc->vc_state = ESesc; in handle_ascii()
2296 del(vc); in handle_ascii()
2299 vc->vc_state = ESsquare; in handle_ascii()
2307 * Handle a character (@c) following an ESC (when @vc is in the ESesc state).
2311 static void handle_esc(struct tty_struct *tty, struct vc_data *vc, u8 c) in handle_esc() argument
2313 vc->vc_state = ESnormal; in handle_esc()
2316 vc->vc_state = ESsquare; in handle_esc()
2319 vc->vc_state = ESnonstd; in handle_esc()
2322 vc->vc_state = ESapc; in handle_esc()
2325 vc->vc_state = ESpm; in handle_esc()
2328 vc->vc_state = ESpercent; in handle_esc()
2331 cr(vc); in handle_esc()
2332 lf(vc); in handle_esc()
2335 ri(vc); in handle_esc()
2338 lf(vc); in handle_esc()
2341 if (vc->state.x < VC_TABSTOPS_COUNT) in handle_esc()
2342 set_bit(vc->state.x, vc->vc_tab_stop); in handle_esc()
2345 vc->vc_state = ESdcs; in handle_esc()
2351 save_cur(vc); in handle_esc()
2354 restore_cur(vc); in handle_esc()
2357 vc->vc_state = ESsetG0; in handle_esc()
2360 vc->vc_state = ESsetG1; in handle_esc()
2363 vc->vc_state = EShash; in handle_esc()
2366 reset_terminal(vc, 1); in handle_esc()
2369 clr_kbd(vc, kbdapplic); in handle_esc()
2372 set_kbd(vc, kbdapplic); in handle_esc()
2379 * are in @vc->vc_par and the char is in @c here.
2381 static void csi_DEC(struct tty_struct *tty, struct vc_data *vc, u8 c) in csi_DEC() argument
2385 csi_DEC_hl(vc, true); in csi_DEC()
2388 csi_DEC_hl(vc, false); in csi_DEC()
2391 if (vc->vc_par[0]) in csi_DEC()
2392 vc->vc_cursor_type = CUR_MAKE(vc->vc_par[0], in csi_DEC()
2393 vc->vc_par[1], in csi_DEC()
2394 vc->vc_par[2]); in csi_DEC()
2396 vc->vc_cursor_type = cur_default; in csi_DEC()
2400 if (vc->vc_par[0]) in csi_DEC()
2401 vc->vc_complement_mask = vc->vc_par[0] << 8 | vc->vc_par[1]; in csi_DEC()
2403 vc->vc_complement_mask = vc->vc_s_complement_mask; in csi_DEC()
2406 if (vc->vc_par[0] == 5) in csi_DEC()
2408 else if (vc->vc_par[0] == 6) in csi_DEC()
2409 cursor_report(vc, tty); in csi_DEC()
2416 * "ESC [ parameters char". Parameters are in @vc->vc_par and the char is in
2419 static void csi_ECMA(struct tty_struct *tty, struct vc_data *vc, u8 c) in csi_ECMA() argument
2424 if (vc->vc_par[0]) in csi_ECMA()
2425 vc->vc_par[0]--; in csi_ECMA()
2426 gotoxy(vc, vc->vc_par[0], vc->state.y); in csi_ECMA()
2429 if (!vc->vc_par[0]) in csi_ECMA()
2430 vc->vc_par[0]++; in csi_ECMA()
2431 gotoxy(vc, vc->state.x, vc->state.y - vc->vc_par[0]); in csi_ECMA()
2435 if (!vc->vc_par[0]) in csi_ECMA()
2436 vc->vc_par[0]++; in csi_ECMA()
2437 gotoxy(vc, vc->state.x, vc->state.y + vc->vc_par[0]); in csi_ECMA()
2441 if (!vc->vc_par[0]) in csi_ECMA()
2442 vc->vc_par[0]++; in csi_ECMA()
2443 gotoxy(vc, vc->state.x + vc->vc_par[0], vc->state.y); in csi_ECMA()
2446 if (!vc->vc_par[0]) in csi_ECMA()
2447 vc->vc_par[0]++; in csi_ECMA()
2448 gotoxy(vc, vc->state.x - vc->vc_par[0], vc->state.y); in csi_ECMA()
2451 if (!vc->vc_par[0]) in csi_ECMA()
2452 vc->vc_par[0]++; in csi_ECMA()
2453 gotoxy(vc, 0, vc->state.y + vc->vc_par[0]); in csi_ECMA()
2456 if (!vc->vc_par[0]) in csi_ECMA()
2457 vc->vc_par[0]++; in csi_ECMA()
2458 gotoxy(vc, 0, vc->state.y - vc->vc_par[0]); in csi_ECMA()
2461 if (vc->vc_par[0]) in csi_ECMA()
2462 vc->vc_par[0]--; in csi_ECMA()
2463 gotoxay(vc, vc->state.x ,vc->vc_par[0]); in csi_ECMA()
2467 if (vc->vc_par[0]) in csi_ECMA()
2468 vc->vc_par[0]--; in csi_ECMA()
2469 if (vc->vc_par[1]) in csi_ECMA()
2470 vc->vc_par[1]--; in csi_ECMA()
2471 gotoxay(vc, vc->vc_par[1], vc->vc_par[0]); in csi_ECMA()
2474 csi_J(vc, vc->vc_par[0]); in csi_ECMA()
2477 csi_K(vc); in csi_ECMA()
2480 csi_L(vc); in csi_ECMA()
2483 csi_M(vc); in csi_ECMA()
2486 csi_P(vc); in csi_ECMA()
2489 if (!vc->vc_par[0]) in csi_ECMA()
2493 if (!vc->vc_par[0] && vc->state.x < VC_TABSTOPS_COUNT) in csi_ECMA()
2494 set_bit(vc->state.x, vc->vc_tab_stop); in csi_ECMA()
2495 else if (vc->vc_par[0] == 3) in csi_ECMA()
2496 bitmap_zero(vc->vc_tab_stop, VC_TABSTOPS_COUNT); in csi_ECMA()
2499 csi_hl(vc, true); in csi_ECMA()
2502 csi_hl(vc, false); in csi_ECMA()
2505 csi_m(vc); in csi_ECMA()
2508 if (vc->vc_par[0] == 5) in csi_ECMA()
2510 else if (vc->vc_par[0] == 6) in csi_ECMA()
2511 cursor_report(vc, tty); in csi_ECMA()
2515 if (vc->vc_par[0] < 4) in csi_ECMA()
2516 vt_set_led_state(vc->vc_num, in csi_ECMA()
2517 (vc->vc_par[0] < 3) ? vc->vc_par[0] : 4); in csi_ECMA()
2520 if (!vc->vc_par[0]) in csi_ECMA()
2521 vc->vc_par[0]++; in csi_ECMA()
2522 if (!vc->vc_par[1]) in csi_ECMA()
2523 vc->vc_par[1] = vc->vc_rows; in csi_ECMA()
2525 if (vc->vc_par[0] < vc->vc_par[1] && in csi_ECMA()
2526 vc->vc_par[1] <= vc->vc_rows) { in csi_ECMA()
2527 vc->vc_top = vc->vc_par[0] - 1; in csi_ECMA()
2528 vc->vc_bottom = vc->vc_par[1]; in csi_ECMA()
2529 gotoxay(vc, 0, 0); in csi_ECMA()
2533 save_cur(vc); in csi_ECMA()
2536 restore_cur(vc); in csi_ECMA()
2539 csi_X(vc); in csi_ECMA()
2542 csi_at(vc, vc->vc_par[0]); in csi_ECMA()
2545 csi_RSB(vc); in csi_ECMA()
2551 static void vc_reset_params(struct vc_data *vc) in vc_reset_params() argument
2553 memset(vc->vc_par, 0, sizeof(vc->vc_par)); in vc_reset_params()
2554 vc->vc_npar = 0; in vc_reset_params()
2558 static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, u8 c) in do_con_trol() argument
2564 if (ansi_control_string(vc->vc_state) && c >= ASCII_IGNORE_FIRST && in do_con_trol()
2568 if (handle_ascii(tty, vc, c)) in do_con_trol()
2571 switch(vc->vc_state) { in do_con_trol()
2573 handle_esc(tty, vc, c); in do_con_trol()
2578 vc_reset_params(vc); in do_con_trol()
2579 vc->vc_state = ESpalette; in do_con_trol()
2582 reset_palette(vc); in do_con_trol()
2585 vc->vc_state = ESosc; in do_con_trol()
2588 vc->vc_state = ESnormal; in do_con_trol()
2592 vc->vc_par[vc->vc_npar++] = hex_to_bin(c); in do_con_trol()
2593 if (vc->vc_npar == 7) { in do_con_trol()
2594 int i = vc->vc_par[0] * 3, j = 1; in do_con_trol()
2595 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2596 vc->vc_palette[i++] += vc->vc_par[j++]; in do_con_trol()
2597 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2598 vc->vc_palette[i++] += vc->vc_par[j++]; in do_con_trol()
2599 vc->vc_palette[i] = 16 * vc->vc_par[j++]; in do_con_trol()
2600 vc->vc_palette[i] += vc->vc_par[j]; in do_con_trol()
2601 set_palette(vc); in do_con_trol()
2602 vc->vc_state = ESnormal; in do_con_trol()
2605 vc->vc_state = ESnormal; in do_con_trol()
2608 vc_reset_params(vc); in do_con_trol()
2610 vc->vc_state = ESgetpars; in do_con_trol()
2613 vc->vc_state = ESfunckey; in do_con_trol()
2616 vc->vc_priv = EPdec; in do_con_trol()
2619 vc->vc_priv = EPgt; in do_con_trol()
2622 vc->vc_priv = EPeq; in do_con_trol()
2625 vc->vc_priv = EPlt; in do_con_trol()
2628 vc->vc_priv = EPecma; in do_con_trol()
2633 if (vc->vc_npar < NPAR - 1) { in do_con_trol()
2634 vc->vc_npar++; in do_con_trol()
2639 vc->vc_par[vc->vc_npar] *= 10; in do_con_trol()
2640 vc->vc_par[vc->vc_npar] += c - '0'; in do_con_trol()
2644 vc->vc_state = EScsiignore; in do_con_trol()
2650 vc->vc_state = ESnormal; in do_con_trol()
2652 switch (vc->vc_priv) { in do_con_trol()
2654 csi_DEC(tty, vc, c); in do_con_trol()
2657 csi_ECMA(tty, vc, c); in do_con_trol()
2665 vc->vc_state = ESnormal; in do_con_trol()
2668 vc->vc_state = ESnormal; in do_con_trol()
2671 vc->vc_utf = 0; in do_con_trol()
2675 vc->vc_utf = 1; in do_con_trol()
2680 vc->vc_state = ESnormal; in do_con_trol()
2683 vc->vc_state = ESnormal; in do_con_trol()
2686 vc->vc_video_erase_char = in do_con_trol()
2687 (vc->vc_video_erase_char & 0xff00) | 'E'; in do_con_trol()
2688 csi_J(vc, CSI_J_VISIBLE); in do_con_trol()
2689 vc->vc_video_erase_char = in do_con_trol()
2690 (vc->vc_video_erase_char & 0xff00) | ' '; in do_con_trol()
2691 do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); in do_con_trol()
2695 vc_setGx(vc, 0, c); in do_con_trol()
2696 vc->vc_state = ESnormal; in do_con_trol()
2699 vc_setGx(vc, 1, c); in do_con_trol()
2700 vc->vc_state = ESnormal; in do_con_trol()
2711 vc->vc_state = ESnormal; in do_con_trol()
2757 static void con_flush(struct vc_data *vc, struct vc_draw_region *draw) in con_flush() argument
2762 vc->vc_sw->con_putcs(vc, (u16 *)draw->from, in con_flush()
2763 (u16 *)draw->to - (u16 *)draw->from, vc->state.y, in con_flush()
2768 static inline int vc_translate_ascii(const struct vc_data *vc, int c) in vc_translate_ascii() argument
2771 if (vc->vc_toggle_meta) in vc_translate_ascii()
2774 return vc->vc_translate[c]; in vc_translate_ascii()
2795 * @vc: virtual console
2812 static int vc_translate_unicode(struct vc_data *vc, int c, bool *rescan) in vc_translate_unicode() argument
2819 if (!vc->vc_utf_count) in vc_translate_unicode()
2822 vc->vc_utf_char = (vc->vc_utf_char << 6) | (c & 0x3f); in vc_translate_unicode()
2823 vc->vc_npar++; in vc_translate_unicode()
2824 if (--vc->vc_utf_count) in vc_translate_unicode()
2828 c = vc->vc_utf_char; in vc_translate_unicode()
2830 if (c <= utf8_length_changes[vc->vc_npar - 1] || in vc_translate_unicode()
2831 c > utf8_length_changes[vc->vc_npar]) in vc_translate_unicode()
2838 if (vc->vc_utf_count) { in vc_translate_unicode()
2841 vc->vc_utf_count = 0; in vc_translate_unicode()
2850 vc->vc_npar = 0; in vc_translate_unicode()
2852 vc->vc_utf_count = 1; in vc_translate_unicode()
2853 vc->vc_utf_char = (c & 0x1f); in vc_translate_unicode()
2855 vc->vc_utf_count = 2; in vc_translate_unicode()
2856 vc->vc_utf_char = (c & 0x0f); in vc_translate_unicode()
2858 vc->vc_utf_count = 3; in vc_translate_unicode()
2859 vc->vc_utf_char = (c & 0x07); in vc_translate_unicode()
2868 static int vc_translate(struct vc_data *vc, int *c, bool *rescan) in vc_translate() argument
2871 if (vc->vc_state != ESnormal) in vc_translate()
2874 if (vc->vc_utf && !vc->vc_disp_ctrl) in vc_translate()
2875 return *c = vc_translate_unicode(vc, *c, rescan); in vc_translate()
2878 return vc_translate_ascii(vc, *c); in vc_translate()
2881 static inline unsigned char vc_invert_attr(const struct vc_data *vc) in vc_invert_attr() argument
2883 if (!vc->vc_can_do_color) in vc_invert_attr()
2884 return vc->vc_attr ^ 0x08; in vc_invert_attr()
2886 if (vc->vc_hi_font_mask == 0x100) in vc_invert_attr()
2887 return (vc->vc_attr & 0x11) | in vc_invert_attr()
2888 ((vc->vc_attr & 0xe0) >> 4) | in vc_invert_attr()
2889 ((vc->vc_attr & 0x0e) << 4); in vc_invert_attr()
2891 return (vc->vc_attr & 0x88) | in vc_invert_attr()
2892 ((vc->vc_attr & 0x70) >> 4) | in vc_invert_attr()
2893 ((vc->vc_attr & 0x07) << 4); in vc_invert_attr()
2896 static bool vc_is_control(struct vc_data *vc, int tc, int c) in vc_is_control() argument
2912 if (vc->vc_state != ESnormal) in vc_is_control()
2928 if (vc->vc_disp_ctrl) in vc_is_control()
2931 return vc->vc_utf || (CTRL_ACTION & BIT(c)); in vc_is_control()
2934 if (c == ASCII_DEL && !vc->vc_disp_ctrl) in vc_is_control()
2943 static int vc_con_write_normal(struct vc_data *vc, int tc, int c, in vc_con_write_normal() argument
2947 unsigned char vc_attr = vc->vc_attr; in vc_con_write_normal()
2948 u16 himask = vc->vc_hi_font_mask, charmask = himask ? 0x1ff : 0xff; in vc_con_write_normal()
2952 if (vc->vc_utf && !vc->vc_disp_ctrl) { in vc_con_write_normal()
2958 tc = conv_uni_to_pc(vc, tc); in vc_con_write_normal()
2964 if ((!vc->vc_utf || vc->vc_disp_ctrl || c < 128) && in vc_con_write_normal()
2980 tc = conv_uni_to_pc(vc, 0xfffd); in vc_con_write_normal()
2983 tc = conv_uni_to_pc(vc, '?'); in vc_con_write_normal()
2987 vc_attr = vc_invert_attr(vc); in vc_con_write_normal()
2988 con_flush(vc, draw); in vc_con_write_normal()
2995 if (vc->vc_need_wrap || vc->vc_decim) in vc_con_write_normal()
2996 con_flush(vc, draw); in vc_con_write_normal()
2997 if (vc->vc_need_wrap) { in vc_con_write_normal()
2998 cr(vc); in vc_con_write_normal()
2999 lf(vc); in vc_con_write_normal()
3001 if (vc->vc_decim) in vc_con_write_normal()
3002 insert_char(vc, 1); in vc_con_write_normal()
3003 vc_uniscr_putc(vc, next_c); in vc_con_write_normal()
3010 scr_writew(tc, (u16 *)vc->vc_pos); in vc_con_write_normal()
3012 if (con_should_update(vc) && draw->x < 0) { in vc_con_write_normal()
3013 draw->x = vc->state.x; in vc_con_write_normal()
3014 draw->from = vc->vc_pos; in vc_con_write_normal()
3016 if (vc->state.x == vc->vc_cols - 1) { in vc_con_write_normal()
3017 vc->vc_need_wrap = vc->vc_decawm; in vc_con_write_normal()
3018 draw->to = vc->vc_pos + 2; in vc_con_write_normal()
3020 vc->state.x++; in vc_con_write_normal()
3021 draw->to = (vc->vc_pos += 2); in vc_con_write_normal()
3028 tc = conv_uni_to_pc(vc, ' '); in vc_con_write_normal()
3033 notify_write(vc, c); in vc_con_write_normal()
3036 con_flush(vc, draw); in vc_con_write_normal()
3049 struct vc_data *vc = tty->driver_data; in do_con_write() local
3057 currcons = vc->vc_num; in do_con_write()
3067 if (con_is_fg(vc)) in do_con_write()
3068 hide_cursor(vc); in do_con_write()
3070 param.vc = vc; in do_con_write()
3081 tc = vc_translate(vc, &c, &rescan); in do_con_write()
3090 if (vc_is_control(vc, tc, c)) { in do_con_write()
3091 con_flush(vc, &draw); in do_con_write()
3092 do_con_trol(tty, vc, orig); in do_con_write()
3096 if (vc_con_write_normal(vc, tc, c, &draw) < 0) in do_con_write()
3102 con_flush(vc, &draw); in do_con_write()
3104 notify_update(vc); in do_con_write()
3138 struct vc_data *vc = vc_cons[fg_console].d; in console_callback() local
3140 if (vc->vc_mode == KD_TEXT && vc->vc_sw->con_scrolldelta) in console_callback()
3141 vc->vc_sw->con_scrolldelta(vc, scrollback_delta); in console_callback()
3155 struct vc_data *vc = vc_cons[fg_console].d; in set_console() local
3158 (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) { in set_console()
3220 struct vc_data *vc = vc_cons[fg_console].d; in vt_console_print() local
3235 vc = vc_cons[kmsg_console - 1].d; in vt_console_print()
3243 if (vc->vc_mode != KD_TEXT) in vt_console_print()
3247 if (con_is_fg(vc)) in vt_console_print()
3248 hide_cursor(vc); in vt_console_print()
3250 start = (ushort *)vc->vc_pos; in vt_console_print()
3251 start_x = vc->state.x; in vt_console_print()
3256 c == ASCII_BACKSPACE || vc->vc_need_wrap) { in vt_console_print()
3257 if (cnt && con_is_visible(vc)) in vt_console_print()
3258 vc->vc_sw->con_putcs(vc, start, cnt, vc->state.y, start_x); in vt_console_print()
3261 bs(vc); in vt_console_print()
3262 start = (ushort *)vc->vc_pos; in vt_console_print()
3263 start_x = vc->state.x; in vt_console_print()
3267 lf(vc); in vt_console_print()
3268 cr(vc); in vt_console_print()
3269 start = (ushort *)vc->vc_pos; in vt_console_print()
3270 start_x = vc->state.x; in vt_console_print()
3274 vc_uniscr_putc(vc, c); in vt_console_print()
3275 scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); in vt_console_print()
3276 notify_write(vc, c); in vt_console_print()
3278 if (vc->state.x == vc->vc_cols - 1) { in vt_console_print()
3279 vc->vc_need_wrap = 1; in vt_console_print()
3281 vc->vc_pos += 2; in vt_console_print()
3282 vc->state.x++; in vt_console_print()
3285 if (cnt && con_is_visible(vc)) in vt_console_print()
3286 vc->vc_sw->con_putcs(vc, start, cnt, vc->state.y, start_x); in vt_console_print()
3287 set_cursor(vc); in vt_console_print()
3288 notify_update(vc); in vt_console_print()
3317 * Handling of Linux-specific VC ioctls
3461 struct vc_data *vc = tty->driver_data; in con_unthrottle() local
3463 wake_up_interruptible(&vc->paste_wait); in con_unthrottle()
3496 struct vc_data *vc = tty->driver_data; in con_flush_chars() local
3502 set_cursor(vc); in con_flush_chars()
3512 struct vc_data *vc; in con_install() local
3520 vc = vc_cons[currcons].d; in con_install()
3523 if (vc->port.tty) { in con_install()
3528 ret = tty_port_install(&vc->port, driver, tty); in con_install()
3532 tty->driver_data = vc; in con_install()
3533 vc->port.tty = tty; in con_install()
3534 tty_port_get(&vc->port); in con_install()
3540 if (vc->vc_utf) in con_install()
3563 struct vc_data *vc = tty->driver_data; in con_shutdown() local
3564 BUG_ON(vc == NULL); in con_shutdown()
3566 vc->port.tty = NULL; in con_shutdown()
3572 struct vc_data *vc = tty->driver_data; in con_cleanup() local
3574 tty_port_put(&vc->port); in con_cleanup()
3593 static void vc_init(struct vc_data *vc, int do_clear) in vc_init() argument
3597 set_origin(vc); in vc_init()
3598 vc->vc_pos = vc->vc_origin; in vc_init()
3599 reset_vc(vc); in vc_init()
3601 vc->vc_palette[k++] = default_red[j] ; in vc_init()
3602 vc->vc_palette[k++] = default_grn[j] ; in vc_init()
3603 vc->vc_palette[k++] = default_blu[j] ; in vc_init()
3605 vc->vc_def_color = default_color; in vc_init()
3606 vc->vc_ulcolor = default_underline_color; in vc_init()
3607 vc->vc_itcolor = default_italic_color; in vc_init()
3608 vc->vc_halfcolor = 0x08; /* grey */ in vc_init()
3609 init_waitqueue_head(&vc->paste_wait); in vc_init()
3610 reset_terminal(vc, do_clear); in vc_init()
3622 struct vc_data *vc; in con_init() local
3658 vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT); in con_init()
3660 tty_port_init(&vc->port); in con_init()
3661 visual_init(vc, currcons, true); in con_init()
3662 /* Assuming vc->vc_{cols,rows,screenbuf_size} are sane here. */ in con_init()
3663 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); in con_init()
3664 vc_init(vc, currcons || !vc->vc_sw->con_save_screen); in con_init()
3667 master_display_fg = vc = vc_cons[currcons].d; in con_init()
3668 set_origin(vc); in con_init()
3669 save_screen(vc); in con_init()
3670 gotoxy(vc, vc->state.x, vc->state.y); in con_init()
3671 csi_J(vc, CSI_J_CURSOR_TO_END); in con_init()
3672 update_screen(vc); in con_init()
3674 vc->vc_can_do_color ? "colour" : "mono", in con_init()
3675 display_desc, vc->vc_cols, vc->vc_rows); in con_init()
3728 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) in vty_init()
3811 struct vc_data *vc = vc_cons[i].d; in do_bind_con_driver() local
3818 if (!vc || !vc->vc_sw) in do_bind_con_driver()
3823 if (con_is_visible(vc)) { in do_bind_con_driver()
3825 save_screen(vc); in do_bind_con_driver()
3828 old_was_color = vc->vc_can_do_color; in do_bind_con_driver()
3829 vc->vc_sw->con_deinit(vc); in do_bind_con_driver()
3830 vc->vc_origin = (unsigned long)vc->vc_screenbuf; in do_bind_con_driver()
3831 visual_init(vc, i, false); in do_bind_con_driver()
3832 set_origin(vc); in do_bind_con_driver()
3833 update_attr(vc); in do_bind_con_driver()
3839 if (old_was_color != vc->vc_can_do_color) in do_bind_con_driver()
3840 clear_buffer_attributes(vc); in do_bind_con_driver()
3847 struct vc_data *vc = vc_cons[j].d; in do_bind_con_driver() local
3850 vc->vc_can_do_color ? "colour" : "mono", in do_bind_con_driver()
3851 desc, vc->vc_cols, vc->vc_rows); in do_bind_con_driver()
3854 vc = vc_cons[k].d; in do_bind_con_driver()
3855 update_screen(vc); in do_bind_con_driver()
4142 * @vc: virtual console
4146 bool con_is_visible(const struct vc_data *vc) in con_is_visible() argument
4150 return *vc->vc_display_fg == vc; in con_is_visible()
4156 * @vc: virtual console
4162 void con_debug_enter(struct vc_data *vc) in con_debug_enter() argument
4167 saved_vc_mode = vc->vc_mode; in con_debug_enter()
4169 vc->vc_mode = KD_TEXT; in con_debug_enter()
4171 if (vc->vc_sw->con_debug_enter) in con_debug_enter()
4172 vc->vc_sw->con_debug_enter(vc); in con_debug_enter()
4175 if (vc->vc_rows < 999) { in con_debug_enter()
4184 snprintf(lns, 4, "%i", vc->vc_rows); in con_debug_enter()
4188 if (vc->vc_cols < 999) { in con_debug_enter()
4197 snprintf(cols, 4, "%i", vc->vc_cols); in con_debug_enter()
4213 struct vc_data *vc; in con_debug_leave() local
4221 vc = vc_cons[fg_console].d; in con_debug_leave()
4222 if (vc->vc_sw->con_debug_leave) in con_debug_leave()
4223 vc->vc_sw->con_debug_leave(vc); in con_debug_leave()
4469 struct vc_data *vc = vc_cons[fg_console].d; in do_blank_screen() local
4479 vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0); in do_blank_screen()
4486 hide_cursor(vc); in do_blank_screen()
4487 save_screen(vc); in do_blank_screen()
4488 vc->vc_sw->con_blank(vc, VESA_VSYNC_SUSPEND, 1); in do_blank_screen()
4491 set_origin(vc); in do_blank_screen()
4498 if (vc->vc_mode != KD_TEXT) { in do_blank_screen()
4503 hide_cursor(vc); in do_blank_screen()
4507 save_screen(vc); in do_blank_screen()
4509 i = vc->vc_sw->con_blank(vc, vesa_off_interval ? VESA_VSYNC_SUSPEND : in do_blank_screen()
4513 set_origin(vc); in do_blank_screen()
4522 vt_event_post(VT_EVENT_BLANK, vc->vc_num, vc->vc_num); in do_blank_screen()
4531 struct vc_data *vc; in do_unblank_screen() local
4551 vc = vc_cons[fg_console].d; in do_unblank_screen()
4552 if (vc->vc_mode != KD_TEXT) in do_unblank_screen()
4561 if (vc->vc_sw->con_blank(vc, VESA_NO_BLANKING, leaving_gfx)) in do_unblank_screen()
4563 update_screen(vc); in do_unblank_screen()
4566 set_palette(vc); in do_unblank_screen()
4567 set_cursor(vc); in do_unblank_screen()
4568 vt_event_post(VT_EVENT_UNBLANK, vc->vc_num, vc->vc_num); in do_unblank_screen()
4626 static void set_palette(struct vc_data *vc) in set_palette() argument
4630 if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_set_palette) in set_palette()
4631 vc->vc_sw->con_set_palette(vc, color_table); in set_palette()
4687 void reset_palette(struct vc_data *vc) in reset_palette() argument
4691 vc->vc_palette[k++] = default_red[j]; in reset_palette()
4692 vc->vc_palette[k++] = default_grn[j]; in reset_palette()
4693 vc->vc_palette[k++] = default_blu[j]; in reset_palette()
4695 set_palette(vc); in reset_palette()
4716 static int con_font_get(struct vc_data *vc, struct console_font_op *op) in con_font_get() argument
4734 if (vc->vc_mode != KD_TEXT) in con_font_get()
4736 else if (vc->vc_sw->con_font_get) in con_font_get()
4737 rc = vc->vc_sw->con_font_get(vc, &font, vpitch); in con_font_get()
4766 static int con_font_set(struct vc_data *vc, const struct console_font_op *op) in con_font_set() argument
4773 if (vc->vc_mode != KD_TEXT) in con_font_set()
4797 if (vc->vc_mode != KD_TEXT) in con_font_set()
4799 else if (vc->vc_sw->con_font_set) { in con_font_set()
4800 if (vc_is_sel(vc)) in con_font_set()
4802 rc = vc->vc_sw->con_font_set(vc, &font, vpitch, op->flags); in con_font_set()
4810 static int con_font_default(struct vc_data *vc, struct console_font_op *op) in con_font_default() argument
4826 if (vc->vc_mode != KD_TEXT) { in con_font_default()
4830 if (vc->vc_sw->con_font_default) { in con_font_default()
4831 if (vc_is_sel(vc)) in con_font_default()
4833 rc = vc->vc_sw->con_font_default(vc, &font, s); in con_font_default()
4844 int con_font_op(struct vc_data *vc, struct console_font_op *op) in con_font_op() argument
4849 return con_font_set(vc, op); in con_font_op()
4852 return con_font_get(vc, op); in con_font_op()
4854 return con_font_default(vc, op); in con_font_op()
4867 u16 screen_glyph(const struct vc_data *vc, int offset) in screen_glyph() argument
4869 u16 w = scr_readw(screenpos(vc, offset, true)); in screen_glyph()
4872 if (w & vc->vc_hi_font_mask) in screen_glyph()
4878 u32 screen_glyph_unicode(const struct vc_data *vc, int n) in screen_glyph_unicode() argument
4880 u32 **uni_lines = vc->vc_uni_lines; in screen_glyph_unicode()
4883 return uni_lines[n / vc->vc_cols][n % vc->vc_cols]; in screen_glyph_unicode()
4885 return inverse_translate(vc, screen_glyph(vc, n * 2), true); in screen_glyph_unicode()
4890 unsigned short *screen_pos(const struct vc_data *vc, int w_offset, bool viewed) in screen_pos() argument
4892 return screenpos(vc, 2 * w_offset, viewed); in screen_pos()
4896 void getconsxy(const struct vc_data *vc, unsigned char xy[static 2]) in getconsxy() argument
4899 xy[0] = min(vc->state.x, 0xFFu); in getconsxy()
4900 xy[1] = min(vc->state.y, 0xFFu); in getconsxy()
4903 void putconsxy(struct vc_data *vc, unsigned char xy[static const 2]) in putconsxy() argument
4905 hide_cursor(vc); in putconsxy()
4906 gotoxy(vc, xy[0], xy[1]); in putconsxy()
4907 set_cursor(vc); in putconsxy()
4910 u16 vcs_scr_readw(const struct vc_data *vc, const u16 *org) in vcs_scr_readw() argument
4912 if ((unsigned long)org == vc->vc_pos && softcursor_original != -1) in vcs_scr_readw()
4917 void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org) in vcs_scr_writew() argument
4920 if ((unsigned long)org == vc->vc_pos) { in vcs_scr_writew()
4922 add_softcursor(vc); in vcs_scr_writew()
4926 void vcs_scr_updated(struct vc_data *vc) in vcs_scr_updated() argument
4928 notify_update(vc); in vcs_scr_updated()