Lines Matching refs:c
78 static void vgacon_init(struct vc_data *c, int init);
79 static void vgacon_deinit(struct vc_data *c);
80 static void vgacon_cursor(struct vc_data *c, int mode);
81 static int vgacon_switch(struct vc_data *c);
82 static int vgacon_blank(struct vc_data *c, int blank, int mode_switch);
84 static int vgacon_scrolldelta(struct vc_data *c, int lines);
85 static int vgacon_set_origin(struct vc_data *c);
86 static void vgacon_save_screen(struct vc_data *c);
87 static int vgacon_scroll(struct vc_data *c, int t, int b, int dir,
89 static void vgacon_invert_region(struct vc_data *c, u16 * p, int count);
178 static inline void vga_set_mem_top(struct vc_data *c) in vga_set_mem_top() argument
180 write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2); in vga_set_mem_top()
213 static void vgacon_scrollback_update(struct vc_data *c, int t, int count) in vgacon_scrollback_update() argument
217 if (!vgacon_scrollback_size || c->vc_num != fg_console) in vgacon_scrollback_update()
220 p = (void *) (c->vc_origin + t * c->vc_size_row); in vgacon_scrollback_update()
224 p, c->vc_size_row); in vgacon_scrollback_update()
226 p += c->vc_size_row; in vgacon_scrollback_update()
227 vgacon_scrollback_tail += c->vc_size_row; in vgacon_scrollback_update()
239 static void vgacon_restore_screen(struct vc_data *c) in vgacon_restore_screen() argument
244 scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, in vgacon_restore_screen()
245 c->vc_screenbuf_size > vga_vram_size ? in vgacon_restore_screen()
246 vga_vram_size : c->vc_screenbuf_size); in vgacon_restore_screen()
252 static int vgacon_scrolldelta(struct vc_data *c, int lines) in vgacon_scrolldelta() argument
257 c->vc_visible_origin = c->vc_origin; in vgacon_scrolldelta()
258 vga_set_mem_top(c); in vgacon_scrolldelta()
266 vgacon_cursor(c, CM_ERASE); in vgacon_scrolldelta()
267 vgacon_save_screen(c); in vgacon_scrolldelta()
290 c->vc_size_row); in vgacon_scrolldelta()
291 soff -= count * c->vc_size_row; in vgacon_scrolldelta()
298 if (count > c->vc_rows) in vgacon_scrolldelta()
299 count = c->vc_rows; in vgacon_scrolldelta()
304 int diff = c->vc_rows - count; in vgacon_scrolldelta()
305 void *d = (void *) c->vc_origin; in vgacon_scrolldelta()
306 void *s = (void *) c->vc_screenbuf; in vgacon_scrolldelta()
308 count *= c->vc_size_row; in vgacon_scrolldelta()
321 scr_memcpyw(d, s, diff * c->vc_size_row); in vgacon_scrolldelta()
323 vgacon_cursor(c, CM_MOVE); in vgacon_scrolldelta()
332 static void vgacon_restore_screen(struct vc_data *c) in vgacon_restore_screen() argument
334 if (c->vc_origin != c->vc_visible_origin) in vgacon_restore_screen()
335 vgacon_scrolldelta(c, 0); in vgacon_restore_screen()
338 static int vgacon_scrolldelta(struct vc_data *c, int lines) in vgacon_scrolldelta() argument
341 c->vc_visible_origin = c->vc_origin; in vgacon_scrolldelta()
343 int margin = c->vc_size_row * 4; in vgacon_scrolldelta()
347 (c->vc_scr_end - vga_vram_base) + margin) { in vgacon_scrolldelta()
348 ul = c->vc_scr_end - vga_vram_base; in vgacon_scrolldelta()
349 we = vga_rolled_over + c->vc_size_row; in vgacon_scrolldelta()
354 p = (c->vc_visible_origin - vga_vram_base - ul + we) % we + in vgacon_scrolldelta()
355 lines * c->vc_size_row; in vgacon_scrolldelta()
356 st = (c->vc_origin - vga_vram_base - ul + we) % we; in vgacon_scrolldelta()
363 c->vc_visible_origin = vga_vram_base + (p + ul) % we; in vgacon_scrolldelta()
365 vga_set_mem_top(c); in vgacon_scrolldelta()
555 static void vgacon_init(struct vc_data *c, int init) in vgacon_init() argument
564 c->vc_can_do_color = vga_can_do_color; in vgacon_init()
568 c->vc_cols = vga_video_num_columns; in vgacon_init()
569 c->vc_rows = vga_video_num_lines; in vgacon_init()
571 vc_resize(c, vga_video_num_columns, vga_video_num_lines); in vgacon_init()
573 c->vc_scan_lines = vga_scan_lines; in vgacon_init()
574 c->vc_font.height = vga_video_font_height; in vgacon_init()
575 c->vc_complement_mask = 0x7700; in vgacon_init()
577 c->vc_hi_font_mask = 0x0800; in vgacon_init()
578 p = *c->vc_uni_pagedir_loc; in vgacon_init()
579 if (c->vc_uni_pagedir_loc != &vgacon_uni_pagedir) { in vgacon_init()
580 con_free_unimap(c); in vgacon_init()
581 c->vc_uni_pagedir_loc = &vgacon_uni_pagedir; in vgacon_init()
585 con_set_default_unimap(c); in vgacon_init()
593 static void vgacon_deinit(struct vc_data *c) in vgacon_deinit() argument
596 if (CON_IS_VISIBLE(c)) { in vgacon_deinit()
597 c->vc_visible_origin = vga_vram_base; in vgacon_deinit()
598 vga_set_mem_top(c); in vgacon_deinit()
602 con_free_unimap(c); in vgacon_deinit()
603 c->vc_uni_pagedir_loc = &c->vc_uni_pagedir; in vgacon_deinit()
604 con_set_default_unimap(c); in vgacon_deinit()
607 static u8 vgacon_build_attr(struct vc_data *c, u8 color, u8 intensity, in vgacon_build_attr() argument
614 attr = (attr & 0xF0) | c->vc_itcolor; in vgacon_build_attr()
616 attr = (attr & 0xf0) | c->vc_ulcolor; in vgacon_build_attr()
618 attr = (attr & 0xf0) | c->vc_halfcolor; in vgacon_build_attr()
639 static void vgacon_invert_region(struct vc_data *c, u16 * p, int count) in vgacon_invert_region() argument
690 static void vgacon_cursor(struct vc_data *c, int mode) in vgacon_cursor() argument
692 if (c->vc_mode != KD_TEXT) in vgacon_cursor()
695 vgacon_restore_screen(c); in vgacon_cursor()
699 write_vga(14, (c->vc_pos - vga_vram_base) / 2); in vgacon_cursor()
701 vgacon_set_cursor_size(c->vc_x, 31, 30); in vgacon_cursor()
703 vgacon_set_cursor_size(c->vc_x, 31, 31); in vgacon_cursor()
708 write_vga(14, (c->vc_pos - vga_vram_base) / 2); in vgacon_cursor()
709 switch (c->vc_cursor_type & 0x0f) { in vgacon_cursor()
711 vgacon_set_cursor_size(c->vc_x, in vgacon_cursor()
712 c->vc_font.height - in vgacon_cursor()
713 (c->vc_font.height < in vgacon_cursor()
715 c->vc_font.height - in vgacon_cursor()
716 (c->vc_font.height < in vgacon_cursor()
720 vgacon_set_cursor_size(c->vc_x, in vgacon_cursor()
721 c->vc_font.height / 3, in vgacon_cursor()
722 c->vc_font.height - in vgacon_cursor()
723 (c->vc_font.height < in vgacon_cursor()
727 vgacon_set_cursor_size(c->vc_x, in vgacon_cursor()
728 (c->vc_font.height * 2) / 3, in vgacon_cursor()
729 c->vc_font.height - in vgacon_cursor()
730 (c->vc_font.height < in vgacon_cursor()
734 vgacon_set_cursor_size(c->vc_x, in vgacon_cursor()
735 c->vc_font.height / 2, in vgacon_cursor()
736 c->vc_font.height - in vgacon_cursor()
737 (c->vc_font.height < in vgacon_cursor()
742 vgacon_set_cursor_size(c->vc_x, 31, 30); in vgacon_cursor()
744 vgacon_set_cursor_size(c->vc_x, 31, 31); in vgacon_cursor()
747 vgacon_set_cursor_size(c->vc_x, 1, in vgacon_cursor()
748 c->vc_font.height); in vgacon_cursor()
755 static int vgacon_doresize(struct vc_data *c, in vgacon_doresize() argument
759 unsigned int scanlines = height * c->vc_font.height; in vgacon_doresize()
765 vgacon_yres = height * c->vc_font.height; in vgacon_doresize()
817 static int vgacon_switch(struct vc_data *c) in vgacon_switch() argument
819 int x = c->vc_cols * VGA_FONTWIDTH; in vgacon_switch()
820 int y = c->vc_rows * c->vc_font.height; in vgacon_switch()
822 c->vc_font.height; in vgacon_switch()
828 vga_video_num_columns = c->vc_cols; in vgacon_switch()
829 vga_video_num_lines = c->vc_rows; in vgacon_switch()
835 scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, in vgacon_switch()
836 c->vc_screenbuf_size > vga_vram_size ? in vgacon_switch()
837 vga_vram_size : c->vc_screenbuf_size); in vgacon_switch()
843 vgacon_doresize(c, c->vc_cols, c->vc_rows); in vgacon_switch()
846 vgacon_scrollback_init(c->vc_size_row); in vgacon_switch()
1006 static int vgacon_blank(struct vc_data *c, int blank, int mode_switch) in vgacon_blank() argument
1015 vga_set_palette(c, color_table); in vgacon_blank()
1029 vgacon_set_origin(c); in vgacon_blank()
1031 c->vc_screenbuf_size); in vgacon_blank()
1198 struct vc_data *c = vc_cons[i].d; in vgacon_do_font_op() local
1199 if (c && c->vc_sw == &vga_con) { in vgacon_do_font_op()
1202 c->vc_hi_font_mask = 0x00; in vgacon_do_font_op()
1203 clear_buffer_attributes(c); in vgacon_do_font_op()
1204 c->vc_hi_font_mask = ch512 ? 0x0800 : 0; in vgacon_do_font_op()
1255 struct vc_data *c = vc_cons[i].d; in vgacon_adjust_height() local
1257 if (c && c->vc_sw == &vga_con) { in vgacon_adjust_height()
1258 if (CON_IS_VISIBLE(c)) { in vgacon_adjust_height()
1262 c->vc_sw->con_cursor(c, CM_DRAW); in vgacon_adjust_height()
1264 c->vc_font.height = fontheight; in vgacon_adjust_height()
1265 vc_resize(c, 0, rows); /* Adjust console size */ in vgacon_adjust_height()
1271 static int vgacon_font_set(struct vc_data *c, struct console_font *font, unsigned flags) in vgacon_font_set() argument
1288 rc = vgacon_adjust_height(c, font->height); in vgacon_font_set()
1292 static int vgacon_font_get(struct vc_data *c, struct console_font *font) in vgacon_font_get() argument
1298 font->height = c->vc_font.height; in vgacon_font_get()
1312 static int vgacon_resize(struct vc_data *c, unsigned int width, in vgacon_resize() argument
1317 c->vc_font.height) in vgacon_resize()
1322 if (CON_IS_VISIBLE(c) && !vga_is_gfx) /* who knows */ in vgacon_resize()
1323 vgacon_doresize(c, width, height); in vgacon_resize()
1327 static int vgacon_set_origin(struct vc_data *c) in vgacon_set_origin() argument
1332 c->vc_origin = c->vc_visible_origin = vga_vram_base; in vgacon_set_origin()
1333 vga_set_mem_top(c); in vgacon_set_origin()
1338 static void vgacon_save_screen(struct vc_data *c) in vgacon_save_screen() argument
1348 c->vc_x = screen_info.orig_x; in vgacon_save_screen()
1349 c->vc_y = screen_info.orig_y; in vgacon_save_screen()
1356 scr_memcpyw((u16 *) c->vc_screenbuf, (u16 *) c->vc_origin, in vgacon_save_screen()
1357 c->vc_screenbuf_size > vga_vram_size ? vga_vram_size : c->vc_screenbuf_size); in vgacon_save_screen()
1360 static int vgacon_scroll(struct vc_data *c, int t, int b, int dir, in vgacon_scroll() argument
1366 if (t || b != c->vc_rows || vga_is_gfx || c->vc_mode != KD_TEXT) in vgacon_scroll()
1369 if (!vga_hardscroll_enabled || lines >= c->vc_rows / 2) in vgacon_scroll()
1372 vgacon_restore_screen(c); in vgacon_scroll()
1373 oldo = c->vc_origin; in vgacon_scroll()
1374 delta = lines * c->vc_size_row; in vgacon_scroll()
1376 vgacon_scrollback_update(c, t, lines); in vgacon_scroll()
1377 if (c->vc_scr_end + delta >= vga_vram_end) { in vgacon_scroll()
1380 c->vc_screenbuf_size - delta); in vgacon_scroll()
1381 c->vc_origin = vga_vram_base; in vgacon_scroll()
1384 c->vc_origin += delta; in vgacon_scroll()
1385 scr_memsetw((u16 *) (c->vc_origin + c->vc_screenbuf_size - in vgacon_scroll()
1386 delta), c->vc_video_erase_char, in vgacon_scroll()
1391 c->vc_screenbuf_size + in vgacon_scroll()
1393 c->vc_screenbuf_size - delta); in vgacon_scroll()
1394 c->vc_origin = vga_vram_end - c->vc_screenbuf_size; in vgacon_scroll()
1397 c->vc_origin -= delta; in vgacon_scroll()
1398 c->vc_scr_end = c->vc_origin + c->vc_screenbuf_size; in vgacon_scroll()
1399 scr_memsetw((u16 *) (c->vc_origin), c->vc_video_erase_char, in vgacon_scroll()
1402 c->vc_scr_end = c->vc_origin + c->vc_screenbuf_size; in vgacon_scroll()
1403 c->vc_visible_origin = c->vc_origin; in vgacon_scroll()
1404 vga_set_mem_top(c); in vgacon_scroll()
1405 c->vc_pos = (c->vc_pos - oldo) + c->vc_origin; in vgacon_scroll()
1414 static int vgacon_dummy(struct vc_data *c) in vgacon_dummy() argument