Author: marcel
Date: Thu Aug 13 14:43:11 2015
New Revision: 286723
URL: https://svnweb.freebsd.org/changeset/base/286723

Log:
  Fix text mode operation.
  
  We first map 64KB at 0xA0000 and then determine whether to work
  in text or graphics mode.  When graphics mode, the mapping is
  precisely what we need and everything is fine.  But text mode,
  has the frame buffer relocated to 0xB8000. We didn't map that
  much to safely add 0x18000 bytes to the base address.
  
  Now we first check whether to work in text or graphics mode and
  then map the frame buffer at the right address and with the
  right size (0xA0000+64KB for graphics, 0xB8000+32KB for text).
  
  PR:           202276
  Tested by:    ed@

Modified:
  head/sys/dev/vt/hw/vga/vt_vga.c
  head/sys/dev/vt/hw/vga/vt_vga_reg.h

Modified: head/sys/dev/vt/hw/vga/vt_vga.c
==============================================================================
--- head/sys/dev/vt/hw/vga/vt_vga.c     Thu Aug 13 13:38:09 2015        
(r286722)
+++ head/sys/dev/vt/hw/vga/vt_vga.c     Thu Aug 13 14:43:11 2015        
(r286723)
@@ -883,9 +883,9 @@ vga_bitblt_text_txtmode(struct vt_device
                        /* Convert colors to VGA attributes. */
                        attr = bg << 4 | fg;
 
-                       MEM_WRITE1(sc, 0x18000 + (row * 80 + col) * 2 + 0,
+                       MEM_WRITE1(sc, (row * 80 + col) * 2 + 0,
                            ch);
-                       MEM_WRITE1(sc, 0x18000 + (row * 80 + col) * 2 + 1,
+                       MEM_WRITE1(sc, (row * 80 + col) * 2 + 1,
                            attr);
                }
        }
@@ -1226,8 +1226,6 @@ vga_init(struct vt_device *vd)
 # error "Architecture not yet supported!"
 #endif
 
-       bus_space_map(sc->vga_fb_tag, VGA_MEM_BASE, VGA_MEM_SIZE, 0,
-           &sc->vga_fb_handle);
        bus_space_map(sc->vga_reg_tag, VGA_REG_BASE, VGA_REG_SIZE, 0,
            &sc->vga_reg_handle);
 
@@ -1236,9 +1234,13 @@ vga_init(struct vt_device *vd)
                vd->vd_flags |= VDF_TEXTMODE;
                vd->vd_width = 80;
                vd->vd_height = 25;
+               bus_space_map(sc->vga_fb_tag, VGA_TXT_BASE, VGA_TXT_SIZE, 0,
+                   &sc->vga_fb_handle);
        } else {
                vd->vd_width = VT_VGA_WIDTH;
                vd->vd_height = VT_VGA_HEIGHT;
+               bus_space_map(sc->vga_fb_tag, VGA_MEM_BASE, VGA_MEM_SIZE, 0,
+                   &sc->vga_fb_handle);
        }
        if (vga_initialize(vd, textmode) != 0)
                return (CN_DEAD);

Modified: head/sys/dev/vt/hw/vga/vt_vga_reg.h
==============================================================================
--- head/sys/dev/vt/hw/vga/vt_vga_reg.h Thu Aug 13 13:38:09 2015        
(r286722)
+++ head/sys/dev/vt/hw/vga/vt_vga_reg.h Thu Aug 13 14:43:11 2015        
(r286723)
@@ -49,6 +49,8 @@
 
 #define        VGA_MEM_BASE    0xA0000
 #define        VGA_MEM_SIZE    0x10000
+#define        VGA_TXT_BASE    0xB8000
+#define        VGA_TXT_SIZE    0x08000
 #define        VGA_REG_BASE    0x3c0
 #define        VGA_REG_SIZE    0x10+0x0c
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to