summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2003-06-14 17:01:06 +0000
committerthorpej <thorpej@NetBSD.org>2003-06-14 17:01:06 +0000
commit0eff67182063296fdff3cc65b22d4e2bd37b026d (patch)
treee6e84834f7446c89ef5e4ae39168ef621ebf247f /sys/dev
parentfee392c19711a257212390df1c60829c45e46e8c (diff)
Also pass a type argument to comcnattach() and com_kgdb_attach().
comspeed() (and thus cominit()) may need this information.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/com.c28
-rw-r--r--sys/dev/ic/comvar.h6
-rw-r--r--sys/dev/pci/puccn.c10
3 files changed, 24 insertions, 20 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index 38ad9c584a4..622879773ac 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.209 2003/06/14 16:25:52 thorpej Exp $ */
+/* $NetBSD: com.c,v 1.210 2003/06/14 17:01:06 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.209 2003/06/14 16:25:52 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.210 2003/06/14 17:01:06 thorpej Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@@ -138,7 +138,7 @@ static void com_enable_debugport(struct com_softc *);
void com_config(struct com_softc *);
void com_shutdown(struct com_softc *);
-int comspeed(long, long);
+int comspeed(long, long, int);
static u_char cflag2lcr(tcflag_t);
int comparam(struct tty *, struct termios *);
void comstart(struct tty *);
@@ -155,7 +155,7 @@ void com_iflush(struct com_softc *);
int com_common_getc(dev_t, bus_space_tag_t, bus_space_handle_t);
void com_common_putc(dev_t, bus_space_tag_t, bus_space_handle_t, int);
-int cominit(bus_space_tag_t, bus_addr_t, int, int, tcflag_t,
+int cominit(bus_space_tag_t, bus_addr_t, int, int, int, tcflag_t,
bus_space_handle_t *);
int comcngetc(dev_t);
@@ -265,8 +265,9 @@ void com_kgdb_putc(void *, int);
#endif
+/*ARGSUSED*/
int
-comspeed(long speed, long frequency)
+comspeed(long speed, long frequency, int type)
{
#define divrnd(n, q) (((n)*2/(q)+1)/2) /* divide and round off */
@@ -1391,7 +1392,8 @@ comparam(struct tty *tp, struct termios *t)
*/
for (prescaler = 0, speed = t->c_ospeed; prescaler < 4;
prescaler++, speed /= 2)
- if ((ospeed = comspeed(speed, sc->sc_frequency)) > 0)
+ if ((ospeed = comspeed(speed, sc->sc_frequency,
+ sc->sc_type)) > 0)
break;
if (prescaler == 4)
@@ -1399,7 +1401,7 @@ comparam(struct tty *tp, struct termios *t)
sc->sc_prescaler = prescaler;
} else
#endif
- ospeed = comspeed(t->c_ospeed, sc->sc_frequency);
+ ospeed = comspeed(t->c_ospeed, sc->sc_frequency, sc->sc_type);
/* Check requested parameters. */
if (ospeed < 0)
@@ -2366,7 +2368,7 @@ com_common_putc(dev_t dev, bus_space_tag_t iot, bus_space_handle_t ioh, int c)
*/
int
cominit(bus_space_tag_t iot, bus_addr_t iobase, int rate, int frequency,
- tcflag_t cflag, bus_space_handle_t *iohp)
+ int type, tcflag_t cflag, bus_space_handle_t *iohp)
{
bus_space_handle_t ioh;
@@ -2376,7 +2378,7 @@ cominit(bus_space_tag_t iot, bus_addr_t iobase, int rate, int frequency,
bus_space_write_1(iot, ioh, com_lcr, LCR_EERS);
bus_space_write_1(iot, ioh, com_efr, 0);
bus_space_write_1(iot, ioh, com_lcr, LCR_DLAB);
- rate = comspeed(rate, frequency);
+ rate = comspeed(rate, frequency, type);
bus_space_write_1(iot, ioh, com_dlbl, rate);
bus_space_write_1(iot, ioh, com_dlbh, rate >> 8);
bus_space_write_1(iot, ioh, com_lcr, cflag2lcr(cflag));
@@ -2400,11 +2402,11 @@ struct consdev comcons = {
int
comcnattach(bus_space_tag_t iot, bus_addr_t iobase, int rate, int frequency,
- tcflag_t cflag)
+ int type, tcflag_t cflag)
{
int res;
- res = cominit(iot, iobase, rate, frequency, cflag, &comconsioh);
+ res = cominit(iot, iobase, rate, frequency, type, cflag, &comconsioh);
if (res)
return (res);
@@ -2446,7 +2448,7 @@ comcnpollc(dev_t dev, int on)
#ifdef KGDB
int
com_kgdb_attach(bus_space_tag_t iot, bus_addr_t iobase, int rate,
- int frequency, tcflag_t cflag)
+ int frequency, int type, tcflag_t cflag)
{
int res;
@@ -2458,7 +2460,7 @@ com_kgdb_attach(bus_space_tag_t iot, bus_addr_t iobase, int rate,
#endif
} else {
- res = cominit(iot, iobase, rate, frequency, cflag,
+ res = cominit(iot, iobase, rate, frequency, type, cflag,
&com_kgdb_ioh);
if (res)
return (res);
diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h
index 393362ad847..1552e2686dd 100644
--- a/sys/dev/ic/comvar.h
+++ b/sys/dev/ic/comvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: comvar.h,v 1.45 2003/06/14 16:25:53 thorpej Exp $ */
+/* $NetBSD: comvar.h,v 1.46 2003/06/14 17:01:06 thorpej Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -46,10 +46,10 @@
#include <sys/lock.h>
#endif
-int comcnattach __P((bus_space_tag_t, bus_addr_t, int, int, tcflag_t));
+int comcnattach __P((bus_space_tag_t, bus_addr_t, int, int, int, tcflag_t));
#ifdef KGDB
-int com_kgdb_attach __P((bus_space_tag_t, bus_addr_t, int, int, tcflag_t));
+int com_kgdb_attach __P((bus_space_tag_t, bus_addr_t, int, int, int, tcflag_t));
#endif
int com_is_console __P((bus_space_tag_t, bus_addr_t, bus_space_handle_t *));
diff --git a/sys/dev/pci/puccn.c b/sys/dev/pci/puccn.c
index d1bc5c7e858..70c7adc0573 100644
--- a/sys/dev/pci/puccn.c
+++ b/sys/dev/pci/puccn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: puccn.c,v 1.5 2003/03/29 20:15:31 matt Exp $ */
+/* $NetBSD: puccn.c,v 1.6 2003/06/14 17:01:06 thorpej Exp $ */
/*
* Derived from pci.c
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puccn.c,v 1.5 2003/03/29 20:15:31 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puccn.c,v 1.6 2003/06/14 17:01:06 thorpej Exp $");
#include "opt_kgdb.h"
@@ -201,7 +201,8 @@ comgdbinit(struct consdev *cn)
if (pucgdbbase == 0) {
return;
}
- com_kgdb_attach(puctag, pucgdbbase, CONSPEED, COM_FREQ, CONMODE);
+ com_kgdb_attach(puctag, pucgdbbase, CONSPEED, COM_FREQ,
+ COM_TYPE_NORMAL, CONMODE);
}
#endif
@@ -217,7 +218,8 @@ comcninit(struct consdev *cn)
if (puccnbase == 0) {
return;
}
- comcnattach(puctag, puccnbase, CONSPEED, COM_FREQ, CONMODE);
+ comcnattach(puctag, puccnbase, CONSPEED, COM_FREQ, COM_TYPE_NORMAL,
+ CONMODE);
}
/* comcngetc, comcnputc, comcnpollc provided by dev/ic/com.c */