diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-10-05 21:01:12 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-10-05 21:01:12 +0000 |
commit | 53ca08c823ee72fc493ace859b84a2eb63eba9fb (patch) | |
tree | 95292dd8eb5a8e67cf54af28f85bdb28c1f4f948 /sys | |
parent | 5959aa59b4e6d720628bd9fde80cd627f38dd6d3 (diff) |
restore some of that dead code needed for dev/cons functionality
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/com.c | 60 | ||||
-rw-r--r-- | sys/dev/ic/comvar.h | 4 |
2 files changed, 61 insertions, 3 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index b4961414e79..793c1fcdd41 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.75 2001/10/02 23:39:27 art Exp $ */ +/* $OpenBSD: com.c,v 1.76 2001/10/05 21:01:10 mickey Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -115,6 +115,7 @@ struct cfdriver com_cd = { }; int comdefaultrate = TTYDEF_SPEED; +int comconsinit; int comconsaddr; int comconsattached; bus_space_tag_t comconsiot; @@ -1483,6 +1484,63 @@ cominit(iot, ioh, rate) splx(s); } +void +comcnprobe(cp) + struct consdev *cp; +{ + /* XXX NEEDS TO BE FIXED XXX */ +#if defined(arc) + bus_space_tag_t iot = &arc_bus_io; +#elif defined(hppa) + bus_space_tag_t iot = &hppa_bustag; +#else + bus_space_tag_t iot = 0; +#endif + bus_space_handle_t ioh; + int found; + + if(CONADDR == 0) { + cp->cn_pri = CN_DEAD; + return; + } + + comconsiot = iot; + if (bus_space_map(iot, CONADDR, COM_NPORTS, 0, &ioh)) { + cp->cn_pri = CN_DEAD; + return; + } + found = comprobe1(iot, ioh); + bus_space_unmap(iot, ioh, COM_NPORTS); + if (!found) { + cp->cn_pri = CN_DEAD; + return; + } + + /* locate the major number */ + for (commajor = 0; commajor < nchrdev; commajor++) + if (cdevsw[commajor].d_open == comopen) + break; + + /* initialize required fields */ + cp->cn_dev = makedev(commajor, CONUNIT); + cp->cn_pri = CN_NORMAL; +} + +void +comcninit(cp) + struct consdev *cp; +{ + + comconsaddr = CONADDR; + + if (bus_space_map(comconsiot, comconsaddr, COM_NPORTS, 0, &comconsioh)) + panic("comcninit: mapping failed"); + + cominit(comconsiot, comconsioh, comdefaultrate); + comconsinit = 0; +} + + int comcnattach(iot, iobase, rate, frequency, cflag) bus_space_tag_t iot; diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h index 5dd663e614d..17939182f07 100644 --- a/sys/dev/ic/comvar.h +++ b/sys/dev/ic/comvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: comvar.h,v 1.29 2001/09/30 15:20:59 art Exp $ */ +/* $OpenBSD: comvar.h,v 1.30 2001/10/05 21:01:11 mickey Exp $ */ /* $NetBSD: comvar.h,v 1.5 1996/05/05 19:50:47 christos Exp $ */ /* @@ -155,6 +155,7 @@ void compoll __P((void *)); struct consdev; int comcnattach __P((bus_space_tag_t, int, int, int, tcflag_t)); +void comcnprobe __P((struct consdev *)); void comcninit __P((struct consdev *)); int comcngetc __P((dev_t)); void comcnputc __P((dev_t, int)); @@ -167,7 +168,6 @@ int com_kgdb_attach __P((bus_space_tag_t, int, int, int, tcflag_t)); int kgdbintr __P((void *)); #endif -int comcnattach __P((bus_space_tag_t, int, int, int, tcflag_t)); void com_attach_subr __P((struct com_softc *)); extern int comdefaultrate; |