summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-16 13:39:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-16 13:39:33 +0000
commit8eb5ebe0e36d8427c9ae2b8c789d4d1483fbbbfc (patch)
tree67a3550020353a662be2ff32fd8a872fbba20a64 /sys/arch/i386
parentf7f1f4bb7ce233e4d42df84e8bea4d7dfd840d23 (diff)
init properly incaseof COMCONSOLE; netbsd pr#2510; enami@ba2.so-net.or.jp
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/isa/pccons.c97
1 files changed, 53 insertions, 44 deletions
diff --git a/sys/arch/i386/isa/pccons.c b/sys/arch/i386/isa/pccons.c
index ce662d0d87d..66a8a97db63 100644
--- a/sys/arch/i386/isa/pccons.c
+++ b/sys/arch/i386/isa/pccons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccons.c,v 1.16 1996/06/10 07:35:35 deraadt Exp $ */
+/* $OpenBSD: pccons.c,v 1.17 1996/06/16 13:39:32 deraadt Exp $ */
/* $NetBSD: pccons.c,v 1.99.4.1 1996/06/04 20:03:53 cgd Exp $ */
/*-
@@ -136,6 +136,7 @@ struct cfdriver pc_cd = {
static unsigned int addr_6845 = MONO_BASE;
+void pcinit __P((void));
char *sget __P((void));
void sput __P((u_char *, int));
void pc_xmode_on __P((void));
@@ -480,6 +481,9 @@ pcattach(parent, self, aux)
struct pc_softc *sc = (void *)self;
struct isa_attach_args *ia = aux;
+ if (crtat == 0)
+ pcinit();
+
printf(": %s\n", vs.color ? "color" : "mono");
do_async_update((void *)1);
screen_restore(0);
@@ -858,6 +862,52 @@ pcparam(tp, t)
return 0;
}
+void
+pcinit()
+{
+ u_short volatile *cp;
+ u_short was;
+ unsigned cursorat;
+
+ cp = ISA_HOLE_VADDR(CGA_BUF);
+ was = *cp;
+ *cp = (u_short) 0xA55A;
+ if (*cp != 0xA55A) {
+ cp = ISA_HOLE_VADDR(MONO_BUF);
+ addr_6845 = MONO_BASE;
+ vs.color = 0;
+ } else {
+ *cp = was;
+ addr_6845 = CGA_BASE;
+ vs.color = 1;
+ }
+
+ /* Extract cursor location */
+ outb(addr_6845, 14);
+ cursorat = inb(addr_6845+1) << 8;
+ outb(addr_6845, 15);
+ cursorat |= inb(addr_6845+1);
+
+#ifdef FAT_CURSOR
+ cursor_shape = 0x0012;
+#endif
+
+ Crtat = (u_short *)cp;
+ crtat = (u_short *)(cp + cursorat);
+
+ vs.ncol = COL;
+ vs.nrow = ROW;
+ vs.nchr = COL * ROW;
+ vs.at = FG_LIGHTGREY | BG_BLACK;
+
+ if (vs.color == 0)
+ vs.so_at = FG_BLACK | BG_LIGHTGREY;
+ else
+ vs.so_at = FG_YELLOW | BG_BLACK;
+
+ fillw((vs.at << 8) | ' ', crtat, vs.nchr - cursorat);
+}
+
#define wrtchar(c, at) do {\
char *cp = (char *)crtat; *cp++ = (c); *cp = (at); crtat++; vs.col++; \
} while (0)
@@ -946,49 +996,8 @@ sput(cp, n)
if (pc_xmode > 0)
return;
- if (crtat == 0) {
- u_short volatile *cp;
- u_short was;
- unsigned cursorat;
-
- cp = ISA_HOLE_VADDR(CGA_BUF);
- was = *cp;
- *cp = (u_short) 0xA55A;
- if (*cp != 0xA55A) {
- cp = ISA_HOLE_VADDR(MONO_BUF);
- addr_6845 = MONO_BASE;
- vs.color = 0;
- } else {
- *cp = was;
- addr_6845 = CGA_BASE;
- vs.color = 1;
- }
-
- /* Extract cursor location */
- outb(addr_6845, 14);
- cursorat = inb(addr_6845+1) << 8;
- outb(addr_6845, 15);
- cursorat |= inb(addr_6845+1);
-
-#ifdef FAT_CURSOR
- cursor_shape = 0x0012;
-#endif
-
- Crtat = (u_short *)cp;
- crtat = (u_short *)(cp + cursorat);
-
- vs.ncol = COL;
- vs.nrow = ROW;
- vs.nchr = COL * ROW;
- vs.at = FG_LIGHTGREY | BG_BLACK;
-
- if (vs.color == 0)
- vs.so_at = FG_BLACK | BG_LIGHTGREY;
- else
- vs.so_at = FG_YELLOW | BG_BLACK;
-
- fillw((vs.at << 8) | ' ', crtat, vs.nchr - cursorat);
- }
+ if (crtat == 0)
+ pcinit();
while (n--) {
if (!(c = *cp++))