summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2008-03-29 15:26:48 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2008-03-29 15:26:48 +0000
commit83316508e2fae3b8d8e394ac1efacbf618cba949 (patch)
treea31828cf5f3b5fa0e7c8f3ab243f3f9f63624d82 /sys/arch
parent52cf24ee419f81b6971a23c36b0372212987481e (diff)
Fix amd64 and i386 serial console handling for non-default speeds. Bring
i386 pccom into line with com. Problem reported and first diff by Markus Hennecke, who also tested and corrected subsequent diffs. Boot messages and console now work with his 57K serial connections. Suggestions and ok miod@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/machdep.c6
-rw-r--r--sys/arch/i386/i386/bios.c6
-rw-r--r--sys/arch/i386/isa/pccom.c19
3 files changed, 15 insertions, 16 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index df38e5e8936..da8b0b29c99 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.68 2008/03/17 23:17:24 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.69 2008/03/29 15:26:47 krw Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -1816,8 +1816,8 @@ getbootinfo(char *bootinfo, int bootinfo_size)
(bios_consdev_t*)q->ba_arg;
#include "com.h"
#if NCOM > 0
- extern int comdefaultrate; /* ic/com.c */
- comdefaultrate = cdp->conspeed;
+ extern int comconsrate; /* ic/com.c */
+ comconsrate = cdp->conspeed;
#endif
#ifdef BOOTINFO_DEBUG
printf(" console 0x%x:%d",
diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c
index f6b2b002788..e566d26e6bd 100644
--- a/sys/arch/i386/i386/bios.c
+++ b/sys/arch/i386/i386/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.78 2008/03/02 18:01:05 deraadt Exp $ */
+/* $OpenBSD: bios.c,v 1.79 2008/03/29 15:26:47 krw Exp $ */
/*
* Copyright (c) 1997-2001 Michael Shalayeff
@@ -480,8 +480,8 @@ bios_getopt()
#include "com.h"
#include "pccom.h"
#if NCOM + NPCCOM > 0
- extern int comdefaultrate; /* ic/com.c */
- comdefaultrate = cdp->conspeed;
+ extern int comconsrate; /* isa/pccom.c */
+ comconsrate = cdp->conspeed;
#endif
#ifdef BIOS_DEBUG
printf(" console 0x%x:%d",
diff --git a/sys/arch/i386/isa/pccom.c b/sys/arch/i386/isa/pccom.c
index 74931000a3f..27413ee143c 100644
--- a/sys/arch/i386/isa/pccom.c
+++ b/sys/arch/i386/isa/pccom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccom.c,v 1.62 2008/01/23 16:37:56 jsing Exp $ */
+/* $OpenBSD: pccom.c,v 1.63 2008/03/29 15:26:47 krw Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
@@ -139,14 +139,11 @@ void cominit(bus_space_tag_t, bus_space_handle_t, int);
#define CONSPEED B9600
#endif
-#if defined(COMCONSOLE) || defined(PCCOMCONSOLE)
-int comdefaultrate = CONSPEED; /* XXX why set default? */
-#else
int comdefaultrate = TTYDEF_SPEED;
-#endif
-bus_addr_t comconsaddr;
+int comconsrate = CONSPEED;
int comconsinit;
int comconsattached;
+bus_addr_t comconsaddr;
bus_space_tag_t comconsiot;
bus_space_handle_t comconsioh;
tcflag_t comconscflag = TTYDEF_CFLAG;
@@ -516,10 +513,13 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
ttychars(tp);
tp->t_iflag = TTYDEF_IFLAG;
tp->t_oflag = TTYDEF_OFLAG;
- if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
+ if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
tp->t_cflag = comconscflag;
- else
+ tp->t_ispeed = tp->t_ospeed = comconsrate;
+ } else {
tp->t_cflag = TTYDEF_CFLAG;
+ tp->t_ispeed = tp->t_ospeed = comdefaultrate;
+ }
if (ISSET(sc->sc_swflags, COM_SW_CLOCAL))
SET(tp->t_cflag, CLOCAL);
if (ISSET(sc->sc_swflags, COM_SW_CRTSCTS))
@@ -527,7 +527,6 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
if (ISSET(sc->sc_swflags, COM_SW_MDMBUF))
SET(tp->t_cflag, MDMBUF);
tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = comdefaultrate;
s = spltty();
@@ -1593,7 +1592,7 @@ comcninit(struct consdev *cp)
if (bus_space_map(comconsiot, comconsaddr, COM_NPORTS, 0, &comconsioh))
panic("comcninit: mapping failed");
- cominit(comconsiot, comconsioh, comdefaultrate);
+ cominit(comconsiot, comconsioh, comconsrate);
comconsinit = 0;
}