Skip to content

Commit 2115aea

Browse files
sthibaulLinus Torvalds
authored andcommitted
[PATCH] vgacon: fix EGA cursor resize function
This corrects cursor resize on ega boards: registers are write-only, so we shouldn't even try to read them. And on ega, 31/30 produces a flat cursor. Using 31/31 is better: except with 32 pixels high fonts, it shouldn't show up. Signed-off-by: Samuel Thibault <[email protected]> Cc: "Antonino A. Daplas" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent c94ded6 commit 2115aea

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

drivers/video/console/vgacon.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -433,17 +433,22 @@ static void vgacon_set_cursor_size(int xpos, int from, int to)
433433
cursor_size_lastto = to;
434434

435435
spin_lock_irqsave(&vga_lock, flags);
436-
outb_p(0x0a, vga_video_port_reg); /* Cursor start */
437-
curs = inb_p(vga_video_port_val);
438-
outb_p(0x0b, vga_video_port_reg); /* Cursor end */
439-
cure = inb_p(vga_video_port_val);
436+
if (vga_video_type >= VIDEO_TYPE_VGAC) {
437+
outb_p(VGA_CRTC_CURSOR_START, vga_video_port_reg);
438+
curs = inb_p(vga_video_port_val);
439+
outb_p(VGA_CRTC_CURSOR_END, vga_video_port_reg);
440+
cure = inb_p(vga_video_port_val);
441+
} else {
442+
curs = 0;
443+
cure = 0;
444+
}
440445

441446
curs = (curs & 0xc0) | from;
442447
cure = (cure & 0xe0) | to;
443448

444-
outb_p(0x0a, vga_video_port_reg); /* Cursor start */
449+
outb_p(VGA_CRTC_CURSOR_START, vga_video_port_reg);
445450
outb_p(curs, vga_video_port_val);
446-
outb_p(0x0b, vga_video_port_reg); /* Cursor end */
451+
outb_p(VGA_CRTC_CURSOR_END, vga_video_port_reg);
447452
outb_p(cure, vga_video_port_val);
448453
spin_unlock_irqrestore(&vga_lock, flags);
449454
}
@@ -455,7 +460,10 @@ static void vgacon_cursor(struct vc_data *c, int mode)
455460
switch (mode) {
456461
case CM_ERASE:
457462
write_vga(14, (c->vc_pos - vga_vram_base) / 2);
458-
vgacon_set_cursor_size(c->vc_x, 31, 30);
463+
if (vga_video_type >= VIDEO_TYPE_VGAC)
464+
vgacon_set_cursor_size(c->vc_x, 31, 30);
465+
else
466+
vgacon_set_cursor_size(c->vc_x, 31, 31);
459467
break;
460468

461469
case CM_MOVE:
@@ -493,7 +501,10 @@ static void vgacon_cursor(struct vc_data *c, int mode)
493501
10 ? 1 : 2));
494502
break;
495503
case CUR_NONE:
496-
vgacon_set_cursor_size(c->vc_x, 31, 30);
504+
if (vga_video_type >= VIDEO_TYPE_VGAC)
505+
vgacon_set_cursor_size(c->vc_x, 31, 30);
506+
else
507+
vgacon_set_cursor_size(c->vc_x, 31, 31);
497508
break;
498509
default:
499510
vgacon_set_cursor_size(c->vc_x, 1,

0 commit comments

Comments
 (0)