summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authoris <is@NetBSD.org>1997-09-16 20:34:23 +0000
committeris <is@NetBSD.org>1997-09-16 20:34:23 +0000
commit718fb97e11bfc33ec278b4c4a652aebf4dee181c (patch)
treebfc07610400deb3fab2234c32e0299e506ca83c7 /sys
parentd1b4b492310958c0e1d2b8a94554becf97007a23 (diff)
Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the mainline code) and adding a frequency parameter right after the rate parameter to comcnattach() and com_kgdb_attach(). - Make com_isa and com_multi initialize sc_frequency to COM_FREQ. - Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq. parameter. * supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints. - com_supio uses the first for interupt establishment (all childs will, as soon as they exist) and the 2nd for sc_frequency. - drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200 - hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/dec_2100_a50.c7
-rw-r--r--sys/arch/alpha/alpha/dec_axppci_33.c7
-rw-r--r--sys/arch/alpha/alpha/dec_eb164.c7
-rw-r--r--sys/arch/alpha/alpha/dec_eb64plus.c7
-rw-r--r--sys/arch/alpha/alpha/dec_kn20aa.c7
-rw-r--r--sys/arch/amiga/dev/com_supio.c18
-rw-r--r--sys/arch/amiga/dev/drsupio.c13
-rw-r--r--sys/arch/amiga/dev/supio.h4
-rw-r--r--sys/arch/i386/i386/machdep.c7
-rw-r--r--sys/dev/ic/com.c30
-rw-r--r--sys/dev/ic/comvar.h10
-rw-r--r--sys/dev/isa/com.c30
-rw-r--r--sys/dev/isa/com_isa.c4
-rw-r--r--sys/dev/isa/com_multi.c3
-rw-r--r--sys/dev/isa/comvar.h10
15 files changed, 94 insertions, 70 deletions
diff --git a/sys/arch/alpha/alpha/dec_2100_a50.c b/sys/arch/alpha/alpha/dec_2100_a50.c
index f3b18bb03c4..4988c06eb3d 100644
--- a/sys/arch/alpha/alpha/dec_2100_a50.c
+++ b/sys/arch/alpha/alpha/dec_2100_a50.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_2100_a50.c,v 1.32 1997/09/02 20:43:07 thorpej Exp $ */
+/* $NetBSD: dec_2100_a50.c,v 1.33 1997/09/16 20:34:41 is Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_2100_a50.c,v 1.32 1997/09/02 20:43:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_2100_a50.c,v 1.33 1997/09/16 20:34:41 is Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -116,7 +116,8 @@ dec_2100_a50_cons_init()
DELAY(160000000 / comcnrate);
if(comcnattach(&acp->ac_iot, 0x3f8, comcnrate,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
+ COM_FREQ,
+ (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
panic("can't init serial console");
break;
diff --git a/sys/arch/alpha/alpha/dec_axppci_33.c b/sys/arch/alpha/alpha/dec_axppci_33.c
index cda9cb68e7a..423594f37c9 100644
--- a/sys/arch/alpha/alpha/dec_axppci_33.c
+++ b/sys/arch/alpha/alpha/dec_axppci_33.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_axppci_33.c,v 1.30 1997/09/02 20:43:09 thorpej Exp $ */
+/* $NetBSD: dec_axppci_33.c,v 1.31 1997/09/16 20:34:42 is Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_axppci_33.c,v 1.30 1997/09/02 20:43:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_axppci_33.c,v 1.31 1997/09/16 20:34:42 is Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -99,7 +99,8 @@ dec_axppci_33_cons_init()
DELAY(160000000 / comcnrate);
if(comcnattach(&lcp->lc_iot, 0x3f8, comcnrate,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
+ COM_FREQ,
+ (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
panic("can't init serial console");
break;
diff --git a/sys/arch/alpha/alpha/dec_eb164.c b/sys/arch/alpha/alpha/dec_eb164.c
index 62787a4244b..20b441c96ea 100644
--- a/sys/arch/alpha/alpha/dec_eb164.c
+++ b/sys/arch/alpha/alpha/dec_eb164.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_eb164.c,v 1.18 1997/09/02 20:43:10 thorpej Exp $ */
+/* $NetBSD: dec_eb164.c,v 1.19 1997/09/16 20:34:43 is Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_eb164.c,v 1.18 1997/09/02 20:43:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_eb164.c,v 1.19 1997/09/16 20:34:43 is Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -96,7 +96,8 @@ dec_eb164_cons_init()
DELAY(160000000 / comcnrate);
if(comcnattach(&ccp->cc_iot, 0x3f8, comcnrate,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
+ COM_FREQ,
+ (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
panic("can't init serial console");
break;
diff --git a/sys/arch/alpha/alpha/dec_eb64plus.c b/sys/arch/alpha/alpha/dec_eb64plus.c
index caa22b58bbc..aab088ed2bb 100644
--- a/sys/arch/alpha/alpha/dec_eb64plus.c
+++ b/sys/arch/alpha/alpha/dec_eb64plus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_eb64plus.c,v 1.7 1997/09/02 20:43:11 thorpej Exp $ */
+/* $NetBSD: dec_eb64plus.c,v 1.8 1997/09/16 20:34:45 is Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_eb64plus.c,v 1.7 1997/09/02 20:43:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_eb64plus.c,v 1.8 1997/09/16 20:34:45 is Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -96,7 +96,8 @@ dec_eb64plus_cons_init()
DELAY(160000000 / comcnrate);
if(comcnattach(&acp->ac_iot, 0x3f8, comcnrate,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
+ COM_FREQ,
+ (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
panic("can't init serial console");
break;
diff --git a/sys/arch/alpha/alpha/dec_kn20aa.c b/sys/arch/alpha/alpha/dec_kn20aa.c
index 26999ad7f8b..f392bc0289b 100644
--- a/sys/arch/alpha/alpha/dec_kn20aa.c
+++ b/sys/arch/alpha/alpha/dec_kn20aa.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_kn20aa.c,v 1.31 1997/09/13 10:09:39 thorpej Exp $ */
+/* $NetBSD: dec_kn20aa.c,v 1.32 1997/09/16 20:34:46 is Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_kn20aa.c,v 1.31 1997/09/13 10:09:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_kn20aa.c,v 1.32 1997/09/16 20:34:46 is Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -99,7 +99,8 @@ dec_kn20aa_cons_init()
DELAY(160000000 / comcnrate);
if(comcnattach(&ccp->cc_iot, 0x3f8, comcnrate,
- (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
+ COM_FREQ,
+ (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8))
panic("can't init serial console");
break;
diff --git a/sys/arch/amiga/dev/com_supio.c b/sys/arch/amiga/dev/com_supio.c
index c73de455dea..200589e3603 100644
--- a/sys/arch/amiga/dev/com_supio.c
+++ b/sys/arch/amiga/dev/com_supio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com_supio.c,v 1.3 1997/08/27 20:41:30 is Exp $ */
+/* $NetBSD: com_supio.c,v 1.4 1997/09/16 20:34:36 is Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996
@@ -97,7 +97,7 @@ com_supio_match(parent, match, aux)
iot = supa->supio_iot;
iobase = supa->supio_iobase;
- if (strcmp(supa->supio_name,"com") || (match->cf_unit > 1))
+ if (strcmp(supa->supio_name,"com"))
return 0;
#if 0
/* if it's in use as console, it's there. */
@@ -122,6 +122,7 @@ com_supio_attach(parent, self, aux)
int iobase;
bus_space_tag_t iot;
struct supio_attach_args *supa = aux;
+ u_int16_t needpsl;
/*
* We're living on a superio chip.
@@ -134,17 +135,22 @@ com_supio_attach(parent, self, aux)
} else
csc->sc_ioh = comconsioh;
+ csc->sc_frequency = supa->supio_arg;
+
printf(" port 0x%x", iobase);
com_attach_subr(csc);
- if (amiga_ttyspl < (PSL_S|PSL_IPL5)) {
+ /* XXX this should be really in the interupt stuff */
+ needpsl = PSL_S | (supa->supio_ipl << 8);
+
+ if (amiga_ttyspl < needpsl) {
printf("%s: raising amiga_ttyspl from 0x%x to 0x%x\n",
- csc->sc_dev.dv_xname, amiga_ttyspl, PSL_S|PSL_IPL5);
- amiga_ttyspl = PSL_S|PSL_IPL5;
+ csc->sc_dev.dv_xname, amiga_ttyspl, needpsl);
+ amiga_ttyspl = needpsl;
}
sc->sc_isr.isr_intr = comintr;
sc->sc_isr.isr_arg = csc;
- sc->sc_isr.isr_ipl = 5;
+ sc->sc_isr.isr_ipl = supa->supio_ipl;
add_isr(&sc->sc_isr);
/*
diff --git a/sys/arch/amiga/dev/drsupio.c b/sys/arch/amiga/dev/drsupio.c
index 5f3476b2690..5c8ac4d5760 100644
--- a/sys/arch/amiga/dev/drsupio.c
+++ b/sys/arch/amiga/dev/drsupio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: drsupio.c,v 1.1 1997/08/27 19:32:53 is Exp $ */
+/* $NetBSD: drsupio.c,v 1.2 1997/09/16 20:34:38 is Exp $ */
/*
* Copyright (c) 1997 Ignatios Souvatzis
@@ -88,11 +88,12 @@ drsupiomatch(parent, cfp, auxp)
struct drsupio_devs {
char *name;
int off;
+ int arg;
} drsupiodevs[] = {
- { "com", 0x3f8 },
- { "com", 0x2f8 },
- { "lpt", 0x378 },
- { "fdc", 0x3f0 },
+ { "com", 0x3f8, 115200 * 16 },
+ { "com", 0x2f8, 115200 * 16 },
+ { "lpt", 0x378, 0 },
+ { "fdc", 0x3f0, 0 },
/* WD port? */
{ 0 }
};
@@ -116,10 +117,12 @@ drsupioattach(parent, self, auxp)
drsc->sc_bst.stride = 2;
supa.supio_iot = &drsc->sc_bst;
+ supa.supio_ipl = 5;
while (drsd->name) {
supa.supio_name = drsd->name;
supa.supio_iobase = drsd->off;
+ supa.supio_arg = drsd->arg;
config_found(self, &supa, drsupprint); /* XXX */
++drsd;
}
diff --git a/sys/arch/amiga/dev/supio.h b/sys/arch/amiga/dev/supio.h
index 01581e63a58..444d4499ded 100644
--- a/sys/arch/amiga/dev/supio.h
+++ b/sys/arch/amiga/dev/supio.h
@@ -1,4 +1,4 @@
-/* $NetBSD: supio.h,v 1.1 1997/08/27 19:32:52 is Exp $ */
+/* $NetBSD: supio.h,v 1.2 1997/09/16 20:34:39 is Exp $ */
/*
* Copyright (c) 1997 Ignatios Souvatzis
@@ -39,4 +39,6 @@ struct supio_attach_args {
bus_space_tag_t supio_iot;
char *supio_name;
int supio_iobase;
+ int supio_ipl;
+ int supio_arg;
};
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 1b885349d08..013830e4564 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.252 1997/09/12 05:01:09 mycroft Exp $ */
+/* $NetBSD: machdep.c,v 1.253 1997/09/16 20:34:34 is Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -1750,7 +1750,7 @@ consinit()
comcnrate = CONSPEED;
comcnmode = CONMODE;
- if(comcnattach(tag, comcnaddr, comcnrate, comcnmode))
+ if(comcnattach(tag, comcnaddr, comcnrate, COM_FREQ, comcnmode))
panic("can't init serial console @%x", comcnaddr);
return;
@@ -1771,7 +1771,8 @@ kgdb_port_init()
comkgdbrate = KGDBRATE;
comkgdbmode = KGDBMODE;
- com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, comkgdbmode);
+ com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, COM_FREQ,
+ comkgdbmode);
}
#endif
}
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index 6d2eb766295..69326e9db35 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.108 1997/08/27 18:00:13 is Exp $ */
+/* $NetBSD: com.c,v 1.109 1997/09/16 20:34:23 is Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997
@@ -109,7 +109,7 @@ static void com_enable_debugport __P((struct com_softc *));
#endif
void com_attach_subr __P((struct com_softc *sc));
void comdiag __P((void *));
-int comspeed __P((long));
+int comspeed __P((long, long));
static u_char cflag2lcr __P((tcflag_t));
int comparam __P((struct tty *, struct termios *));
void comstart __P((struct tty *));
@@ -180,8 +180,8 @@ void com_kgdb_putc __P((void *, int));
#define COMUNIT(x) (minor(x))
int
-comspeed(speed)
- long speed;
+comspeed(speed, frequency)
+ long speed, frequency;
{
#define divrnd(n, q) (((n)*2/(q)+1)/2) /* divide and round off */
@@ -193,10 +193,10 @@ comspeed(speed)
#endif
if (speed <= 0)
return (-1);
- x = divrnd((COM_FREQ / 16), speed);
+ x = divrnd(frequency / 16, speed);
if (x <= 0)
return (-1);
- err = divrnd((COM_FREQ / 16) * 1000, speed * x) - 1000;
+ err = divrnd(frequency * 1000 / 16, speed * x) - 1000;
if (err < 0)
err = -err;
if (err > COM_TOLERANCE)
@@ -847,7 +847,7 @@ comparam(tp, t)
struct termios *t;
{
struct com_softc *sc = com_cd.cd_devs[COMUNIT(tp->t_dev)];
- int ospeed = comspeed(t->c_ospeed);
+ int ospeed = comspeed(t->c_ospeed, sc->sc_frequency);
u_char lcr;
int s;
@@ -1613,10 +1613,10 @@ com_common_putc(iot, ioh, c)
* Initialize UART to known state.
*/
int
-cominit(iot, iobase, rate, cflag, iohp)
+cominit(iot, iobase, rate, frequency, cflag, iohp)
bus_space_tag_t iot;
int iobase;
- int rate;
+ int rate, frequency;
tcflag_t cflag;
bus_space_handle_t *iohp;
{
@@ -1626,7 +1626,7 @@ cominit(iot, iobase, rate, cflag, iohp)
return(ENOMEM); /* ??? */
bus_space_write_1(iot, ioh, com_lcr, LCR_DLAB);
- rate = comspeed(rate);
+ rate = comspeed(rate, frequency);
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));
@@ -1644,17 +1644,17 @@ cominit(iot, iobase, rate, cflag, iohp)
*/
int
-comcnattach(iot, iobase, rate, cflag)
+comcnattach(iot, iobase, rate, frequency, cflag)
bus_space_tag_t iot;
int iobase;
- int rate;
+ int rate, frequency;
tcflag_t cflag;
{
int res;
static struct consdev comcons = { NULL, NULL,
comcngetc, comcnputc, comcnpollc, NODEV, CN_NORMAL};
- res = cominit(iot, iobase, rate, cflag, &comconsioh);
+ res = cominit(iot, iobase, rate, frequency, cflag, &comconsioh);
if(res) return(res);
cn_tab = &comcons;
@@ -1697,7 +1697,7 @@ comcnpollc(dev, on)
#ifdef KGDB
int
-com_kgdb_attach(iot, iobase, rate, cflag)
+com_kgdb_attach(iot, iobase, rate, frequency, cflag)
bus_space_tag_t iot;
int iobase;
int rate;
@@ -1708,7 +1708,7 @@ com_kgdb_attach(iot, iobase, rate, cflag)
if (iot == comconstag && iobase == comconsaddr)
return(EBUSY); /* cannot share with console */
- res = cominit(iot, iobase, rate, cflag, &com_kgdb_ioh);
+ res = cominit(iot, iobase, rate, frequency, cflag, &com_kgdb_ioh);
if(res) return(res);
kgdb_attach(com_kgdb_getc, com_kgdb_putc, NULL);
diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h
index 1ad170ea2cc..fa87123bbd0 100644
--- a/sys/dev/ic/comvar.h
+++ b/sys/dev/ic/comvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: comvar.h,v 1.14 1997/08/23 14:01:34 drochner Exp $ */
+/* $NetBSD: comvar.h,v 1.15 1997/09/16 20:34:29 is Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -30,10 +30,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-int comcnattach __P((bus_space_tag_t, int, int, tcflag_t));
+int comcnattach __P((bus_space_tag_t, int, int, int, tcflag_t));
#ifdef KGDB
-int com_kgdb_attach __P((bus_space_tag_t, int, int, tcflag_t));
+int com_kgdb_attach __P((bus_space_tag_t, int, int, int, tcflag_t));
#endif
int com_is_console __P((bus_space_tag_t, int, bus_space_handle_t *));
@@ -62,6 +62,7 @@ struct com_softc {
int sc_errors;
int sc_iobase;
+ int sc_frequency;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
@@ -110,7 +111,8 @@ struct com_softc {
int comprobe1 __P((bus_space_tag_t, bus_space_handle_t, int));
int comintr __P((void *));
void com_attach_subr __P((struct com_softc *));
-int cominit __P((bus_space_tag_t, int, int, tcflag_t, bus_space_handle_t *));
+int cominit __P((bus_space_tag_t, int, int, int, tcflag_t,
+ bus_space_handle_t *));
#ifndef __GENERIC_SOFT_INTERRUPTS
#ifdef alpha
diff --git a/sys/dev/isa/com.c b/sys/dev/isa/com.c
index 6d2eb766295..69326e9db35 100644
--- a/sys/dev/isa/com.c
+++ b/sys/dev/isa/com.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.108 1997/08/27 18:00:13 is Exp $ */
+/* $NetBSD: com.c,v 1.109 1997/09/16 20:34:23 is Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997
@@ -109,7 +109,7 @@ static void com_enable_debugport __P((struct com_softc *));
#endif
void com_attach_subr __P((struct com_softc *sc));
void comdiag __P((void *));
-int comspeed __P((long));
+int comspeed __P((long, long));
static u_char cflag2lcr __P((tcflag_t));
int comparam __P((struct tty *, struct termios *));
void comstart __P((struct tty *));
@@ -180,8 +180,8 @@ void com_kgdb_putc __P((void *, int));
#define COMUNIT(x) (minor(x))
int
-comspeed(speed)
- long speed;
+comspeed(speed, frequency)
+ long speed, frequency;
{
#define divrnd(n, q) (((n)*2/(q)+1)/2) /* divide and round off */
@@ -193,10 +193,10 @@ comspeed(speed)
#endif
if (speed <= 0)
return (-1);
- x = divrnd((COM_FREQ / 16), speed);
+ x = divrnd(frequency / 16, speed);
if (x <= 0)
return (-1);
- err = divrnd((COM_FREQ / 16) * 1000, speed * x) - 1000;
+ err = divrnd(frequency * 1000 / 16, speed * x) - 1000;
if (err < 0)
err = -err;
if (err > COM_TOLERANCE)
@@ -847,7 +847,7 @@ comparam(tp, t)
struct termios *t;
{
struct com_softc *sc = com_cd.cd_devs[COMUNIT(tp->t_dev)];
- int ospeed = comspeed(t->c_ospeed);
+ int ospeed = comspeed(t->c_ospeed, sc->sc_frequency);
u_char lcr;
int s;
@@ -1613,10 +1613,10 @@ com_common_putc(iot, ioh, c)
* Initialize UART to known state.
*/
int
-cominit(iot, iobase, rate, cflag, iohp)
+cominit(iot, iobase, rate, frequency, cflag, iohp)
bus_space_tag_t iot;
int iobase;
- int rate;
+ int rate, frequency;
tcflag_t cflag;
bus_space_handle_t *iohp;
{
@@ -1626,7 +1626,7 @@ cominit(iot, iobase, rate, cflag, iohp)
return(ENOMEM); /* ??? */
bus_space_write_1(iot, ioh, com_lcr, LCR_DLAB);
- rate = comspeed(rate);
+ rate = comspeed(rate, frequency);
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));
@@ -1644,17 +1644,17 @@ cominit(iot, iobase, rate, cflag, iohp)
*/
int
-comcnattach(iot, iobase, rate, cflag)
+comcnattach(iot, iobase, rate, frequency, cflag)
bus_space_tag_t iot;
int iobase;
- int rate;
+ int rate, frequency;
tcflag_t cflag;
{
int res;
static struct consdev comcons = { NULL, NULL,
comcngetc, comcnputc, comcnpollc, NODEV, CN_NORMAL};
- res = cominit(iot, iobase, rate, cflag, &comconsioh);
+ res = cominit(iot, iobase, rate, frequency, cflag, &comconsioh);
if(res) return(res);
cn_tab = &comcons;
@@ -1697,7 +1697,7 @@ comcnpollc(dev, on)
#ifdef KGDB
int
-com_kgdb_attach(iot, iobase, rate, cflag)
+com_kgdb_attach(iot, iobase, rate, frequency, cflag)
bus_space_tag_t iot;
int iobase;
int rate;
@@ -1708,7 +1708,7 @@ com_kgdb_attach(iot, iobase, rate, cflag)
if (iot == comconstag && iobase == comconsaddr)
return(EBUSY); /* cannot share with console */
- res = cominit(iot, iobase, rate, cflag, &com_kgdb_ioh);
+ res = cominit(iot, iobase, rate, frequency, cflag, &com_kgdb_ioh);
if(res) return(res);
kgdb_attach(com_kgdb_getc, com_kgdb_putc, NULL);
diff --git a/sys/dev/isa/com_isa.c b/sys/dev/isa/com_isa.c
index 6fd199f1dff..4b99319acb2 100644
--- a/sys/dev/isa/com_isa.c
+++ b/sys/dev/isa/com_isa.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com_isa.c,v 1.5 1997/08/23 14:03:54 drochner Exp $ */
+/* $NetBSD: com_isa.c,v 1.6 1997/09/16 20:34:25 is Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996
@@ -124,6 +124,8 @@ com_isa_attach(parent, self, aux)
if(!com_is_console(iot, iobase, &sc->sc_ioh)
&& bus_space_map(iot, iobase, COM_NPORTS, 0, &sc->sc_ioh))
panic("comattach: io mapping failed");
+
+ sc->sc_frequency = COM_FREQ;
irq = ia->ia_irq;
com_attach_subr(sc);
diff --git a/sys/dev/isa/com_multi.c b/sys/dev/isa/com_multi.c
index 787ee747ed9..959deb34d64 100644
--- a/sys/dev/isa/com_multi.c
+++ b/sys/dev/isa/com_multi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com_multi.c,v 1.5 1997/08/23 14:03:55 drochner Exp $ */
+/* $NetBSD: com_multi.c,v 1.6 1997/09/16 20:34:28 is Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996
@@ -106,6 +106,7 @@ com_multi_attach(parent, self, aux)
sc->sc_iot = ca->ca_iot;
sc->sc_ioh = ca->ca_ioh;
sc->sc_iobase = ca->ca_iobase;
+ sc->sc_frequency = 115200 * 16;
if (ca->ca_noien)
sc->sc_hwflags |= COM_HW_NOIEN;
diff --git a/sys/dev/isa/comvar.h b/sys/dev/isa/comvar.h
index 1ad170ea2cc..fa87123bbd0 100644
--- a/sys/dev/isa/comvar.h
+++ b/sys/dev/isa/comvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: comvar.h,v 1.14 1997/08/23 14:01:34 drochner Exp $ */
+/* $NetBSD: comvar.h,v 1.15 1997/09/16 20:34:29 is Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -30,10 +30,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-int comcnattach __P((bus_space_tag_t, int, int, tcflag_t));
+int comcnattach __P((bus_space_tag_t, int, int, int, tcflag_t));
#ifdef KGDB
-int com_kgdb_attach __P((bus_space_tag_t, int, int, tcflag_t));
+int com_kgdb_attach __P((bus_space_tag_t, int, int, int, tcflag_t));
#endif
int com_is_console __P((bus_space_tag_t, int, bus_space_handle_t *));
@@ -62,6 +62,7 @@ struct com_softc {
int sc_errors;
int sc_iobase;
+ int sc_frequency;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
@@ -110,7 +111,8 @@ struct com_softc {
int comprobe1 __P((bus_space_tag_t, bus_space_handle_t, int));
int comintr __P((void *));
void com_attach_subr __P((struct com_softc *));
-int cominit __P((bus_space_tag_t, int, int, tcflag_t, bus_space_handle_t *));
+int cominit __P((bus_space_tag_t, int, int, int, tcflag_t,
+ bus_space_handle_t *));
#ifndef __GENERIC_SOFT_INTERRUPTS
#ifdef alpha