diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2006-02-24 16:03:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-24 17:31:37 -0500 |
commit | d1521260f57d70d0ba86d2a309ec1ce7979be2fc (patch) | |
tree | 1dcdb33e5c9a82a137d15f6857faf02acb435755 /drivers/video/console/vgacon.c | |
parent | fe1db50c7222c67466e41241bc7ef17b469bcf1d (diff) |
[PATCH] vgacon: no vertical resizing on EGA
EGA boards suck: they mostly have write-only registers. This is
particularly problematic for the overflow register: for being able to write
to it, we would have to handle vertical sync & such too, which (I'd say)
would potentially break a lot of configurations. Instead, just disabling
vertical resize for EGA boards is just nice enough (horizontal resize still
works).
Fixes http://bugzilla.kernel.org/show_bug.cgi?id=6106
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Rafal Olearski <olearski@mail2.kim.net.pl>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/console/vgacon.c')
-rw-r--r-- | drivers/video/console/vgacon.c | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 12d9329d1408..5a86978537d2 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -509,57 +509,60 @@ static int vgacon_doresize(struct vc_data *c, | |||
509 | { | 509 | { |
510 | unsigned long flags; | 510 | unsigned long flags; |
511 | unsigned int scanlines = height * c->vc_font.height; | 511 | unsigned int scanlines = height * c->vc_font.height; |
512 | u8 scanlines_lo, r7, vsync_end, mode, max_scan; | 512 | u8 scanlines_lo = 0, r7 = 0, vsync_end = 0, mode, max_scan; |
513 | 513 | ||
514 | spin_lock_irqsave(&vga_lock, flags); | 514 | spin_lock_irqsave(&vga_lock, flags); |
515 | 515 | ||
516 | outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg); | ||
517 | max_scan = inb_p(vga_video_port_val); | ||
518 | |||
519 | if (max_scan & 0x80) | ||
520 | scanlines <<= 1; | ||
521 | |||
522 | vgacon_xres = width * VGA_FONTWIDTH; | 516 | vgacon_xres = width * VGA_FONTWIDTH; |
523 | vgacon_yres = height * c->vc_font.height; | 517 | vgacon_yres = height * c->vc_font.height; |
524 | outb_p(VGA_CRTC_MODE, vga_video_port_reg); | 518 | if (vga_video_type >= VIDEO_TYPE_VGAC) { |
525 | mode = inb_p(vga_video_port_val); | 519 | outb_p(VGA_CRTC_MAX_SCAN, vga_video_port_reg); |
520 | max_scan = inb_p(vga_video_port_val); | ||
526 | 521 | ||
527 | if (mode & 0x04) | 522 | if (max_scan & 0x80) |
528 | scanlines >>= 1; | 523 | scanlines <<= 1; |
529 | 524 | ||
530 | scanlines -= 1; | 525 | outb_p(VGA_CRTC_MODE, vga_video_port_reg); |
531 | scanlines_lo = scanlines & 0xff; | 526 | mode = inb_p(vga_video_port_val); |
532 | 527 | ||
533 | outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); | 528 | if (mode & 0x04) |
534 | r7 = inb_p(vga_video_port_val) & ~0x42; | 529 | scanlines >>= 1; |
535 | 530 | ||
536 | if (scanlines & 0x100) | 531 | scanlines -= 1; |
537 | r7 |= 0x02; | 532 | scanlines_lo = scanlines & 0xff; |
538 | if (scanlines & 0x200) | ||
539 | r7 |= 0x40; | ||
540 | 533 | ||
541 | /* deprotect registers */ | 534 | outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); |
542 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); | 535 | r7 = inb_p(vga_video_port_val) & ~0x42; |
543 | vsync_end = inb_p(vga_video_port_val); | 536 | |
544 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); | 537 | if (scanlines & 0x100) |
545 | outb_p(vsync_end & ~0x80, vga_video_port_val); | 538 | r7 |= 0x02; |
539 | if (scanlines & 0x200) | ||
540 | r7 |= 0x40; | ||
541 | |||
542 | /* deprotect registers */ | ||
543 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); | ||
544 | vsync_end = inb_p(vga_video_port_val); | ||
545 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); | ||
546 | outb_p(vsync_end & ~0x80, vga_video_port_val); | ||
547 | } | ||
546 | 548 | ||
547 | outb_p(VGA_CRTC_H_DISP, vga_video_port_reg); | 549 | outb_p(VGA_CRTC_H_DISP, vga_video_port_reg); |
548 | outb_p(width - 1, vga_video_port_val); | 550 | outb_p(width - 1, vga_video_port_val); |
549 | outb_p(VGA_CRTC_OFFSET, vga_video_port_reg); | 551 | outb_p(VGA_CRTC_OFFSET, vga_video_port_reg); |
550 | outb_p(width >> 1, vga_video_port_val); | 552 | outb_p(width >> 1, vga_video_port_val); |
551 | 553 | ||
552 | outb_p(VGA_CRTC_V_DISP_END, vga_video_port_reg); | 554 | if (vga_video_type >= VIDEO_TYPE_VGAC) { |
553 | outb_p(scanlines_lo, vga_video_port_val); | 555 | outb_p(VGA_CRTC_V_DISP_END, vga_video_port_reg); |
554 | outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); | 556 | outb_p(scanlines_lo, vga_video_port_val); |
555 | outb_p(r7,vga_video_port_val); | 557 | outb_p(VGA_CRTC_OVERFLOW, vga_video_port_reg); |
558 | outb_p(r7,vga_video_port_val); | ||
556 | 559 | ||
557 | /* reprotect registers */ | 560 | /* reprotect registers */ |
558 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); | 561 | outb_p(VGA_CRTC_V_SYNC_END, vga_video_port_reg); |
559 | outb_p(vsync_end, vga_video_port_val); | 562 | outb_p(vsync_end, vga_video_port_val); |
563 | } | ||
560 | 564 | ||
561 | spin_unlock_irqrestore(&vga_lock, flags); | 565 | spin_unlock_irqrestore(&vga_lock, flags); |
562 | |||
563 | return 0; | 566 | return 0; |
564 | } | 567 | } |
565 | 568 | ||