aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/console/vgacon.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index bcf59b28a14f..d27fa91e5886 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -95,6 +95,7 @@ static unsigned long vgacon_uni_pagedir[2];
95/* Description of the hardware situation */ 95/* Description of the hardware situation */
96static unsigned long vga_vram_base; /* Base of video memory */ 96static unsigned long vga_vram_base; /* Base of video memory */
97static unsigned long vga_vram_end; /* End of video memory */ 97static unsigned long vga_vram_end; /* End of video memory */
98static int vga_vram_size; /* Size of video memory */
98static u16 vga_video_port_reg; /* Video register select port */ 99static u16 vga_video_port_reg; /* Video register select port */
99static u16 vga_video_port_val; /* Video register value port */ 100static u16 vga_video_port_val; /* Video register value port */
100static unsigned int vga_video_num_columns; /* Number of text columns */ 101static unsigned int vga_video_num_columns; /* Number of text columns */
@@ -288,6 +289,7 @@ static const char __init *vgacon_startup(void)
288 289
289 vga_vram_base = VGA_MAP_MEM(vga_vram_base); 290 vga_vram_base = VGA_MAP_MEM(vga_vram_base);
290 vga_vram_end = VGA_MAP_MEM(vga_vram_end); 291 vga_vram_end = VGA_MAP_MEM(vga_vram_end);
292 vga_vram_size = vga_vram_end - vga_vram_base;
291 293
292 /* 294 /*
293 * Find out if there is a graphics card present. 295 * Find out if there is a graphics card present.
@@ -504,9 +506,13 @@ static int vgacon_switch(struct vc_data *c)
504 */ 506 */
505 vga_video_num_columns = c->vc_cols; 507 vga_video_num_columns = c->vc_cols;
506 vga_video_num_lines = c->vc_rows; 508 vga_video_num_lines = c->vc_rows;
509
510 /* We can only copy out the size of the video buffer here,
511 * otherwise we get into VGA BIOS */
512
507 if (!vga_is_gfx) 513 if (!vga_is_gfx)
508 scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf, 514 scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
509 c->vc_screenbuf_size); 515 c->vc_screenbuf_size > vga_vram_size ? vga_vram_size : c->vc_screenbuf_size);
510 return 0; /* Redrawing not needed */ 516 return 0; /* Redrawing not needed */
511} 517}
512 518
@@ -961,7 +967,6 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
961 if (!lines) /* Turn scrollback off */ 967 if (!lines) /* Turn scrollback off */
962 c->vc_visible_origin = c->vc_origin; 968 c->vc_visible_origin = c->vc_origin;
963 else { 969 else {
964 int vram_size = vga_vram_end - vga_vram_base;
965 int margin = c->vc_size_row * 4; 970 int margin = c->vc_size_row * 4;
966 int ul, we, p, st; 971 int ul, we, p, st;
967 972
@@ -971,7 +976,7 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
971 we = vga_rolled_over + c->vc_size_row; 976 we = vga_rolled_over + c->vc_size_row;
972 } else { 977 } else {
973 ul = 0; 978 ul = 0;
974 we = vram_size; 979 we = vga_vram_size;
975 } 980 }
976 p = (c->vc_visible_origin - vga_vram_base - ul + we) % we + 981 p = (c->vc_visible_origin - vga_vram_base - ul + we) % we +
977 lines * c->vc_size_row; 982 lines * c->vc_size_row;
@@ -1012,9 +1017,13 @@ static void vgacon_save_screen(struct vc_data *c)
1012 c->vc_x = ORIG_X; 1017 c->vc_x = ORIG_X;
1013 c->vc_y = ORIG_Y; 1018 c->vc_y = ORIG_Y;
1014 } 1019 }
1020
1021 /* We can't copy in more then the size of the video buffer,
1022 * or we'll be copying in VGA BIOS */
1023
1015 if (!vga_is_gfx) 1024 if (!vga_is_gfx)
1016 scr_memcpyw((u16 *) c->vc_screenbuf, (u16 *) c->vc_origin, 1025 scr_memcpyw((u16 *) c->vc_screenbuf, (u16 *) c->vc_origin,
1017 c->vc_screenbuf_size); 1026 c->vc_screenbuf_size > vga_vram_size ? vga_vram_size : c->vc_screenbuf_size);
1018} 1027}
1019 1028
1020static int vgacon_scroll(struct vc_data *c, int t, int b, int dir, 1029static int vgacon_scroll(struct vc_data *c, int t, int b, int dir,