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@
This commit is contained in:
parent
f3bfa7d1cf
commit
6280434f9a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286723
@ -883,9 +883,9 @@ vga_bitblt_text_txtmode(struct vt_device *vd, const struct vt_window *vw,
|
||||
/* 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);
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user