summaryrefslogtreecommitdiff
path: root/sys/dev/ic/com.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2008-04-24 12:29:35 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2008-04-24 12:29:35 +0000
commit3354f891cb68fe04a5bfed6410c86ebe93f59616 (patch)
tree2100a5d626c98203fdb6fd22545b3c1dfed8f1fb /sys/dev/ic/com.c
parent6c3cd7478d6099dd6185d045ea506529af448308 (diff)
Cleanup serial console handling and remove some of the MD code from com.c.
Specify the serial configuration from within the MD code, rather than passing things via macros. This will allow other platforms to more readily change the serial console configuration. Committing this so it actually gets tested. ok dlg@
Diffstat (limited to 'sys/dev/ic/com.c')
-rw-r--r--sys/dev/ic/com.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index 05f810a812b..443c4e64744 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com.c,v 1.122 2008/04/09 19:50:38 deraadt Exp $ */
+/* $OpenBSD: com.c,v 1.123 2008/04/24 12:29:34 jsing Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
@@ -126,7 +126,7 @@ bus_addr_t comsiraddr;
int comconsfreq;
int comconsrate = TTYDEF_SPEED;
int comconsinit;
-bus_addr_t comconsaddr;
+bus_addr_t comconsaddr = CONADDR;
int comconsattached;
bus_space_tag_t comconsiot;
bus_space_handle_t comconsioh;
@@ -1222,16 +1222,6 @@ comintr(void *arg)
}
/*
- * Following are all routines needed for COM to act as console
- */
-
-#if defined(__sgi__)
-#undef CONADDR
-#undef COM_FREQ
-#include <machine/autoconf.h>
-#endif
-
-/*
* The following functions are polled getc and putc routines, shared
* by the console and kgdb glue.
*/
@@ -1327,32 +1317,27 @@ comcnprobe(struct consdev *cp)
{
/* XXX NEEDS TO BE FIXED XXX */
#ifdef MD_ISA_IOT
- bus_space_tag_t iot = MD_ISA_IOT;
-#elif defined(__sgi__)
- bus_space_tag_t iot = sys_config.cons_iot;
-#else
- bus_space_tag_t iot = 0;
+ comconsiot = MD_ISA_IOT;
#endif
bus_space_handle_t ioh;
int found;
- if (CONADDR == 0)
+ if (comconsaddr == 0)
return;
- comconsiot = iot;
- if (bus_space_map(iot, CONADDR, COM_NPORTS, 0, &ioh))
+ if (bus_space_map(comconsiot, comconsaddr, COM_NPORTS, 0, &ioh))
return;
- found = comprobe1(iot, ioh);
- bus_space_unmap(iot, ioh, COM_NPORTS);
+ found = comprobe1(comconsiot, ioh);
+ bus_space_unmap(comconsiot, ioh, COM_NPORTS);
if (!found)
return;
- /* locate the major number */
+ /* Locate the major number. */
for (commajor = 0; commajor < nchrdev; commajor++)
if (cdevsw[commajor].d_open == comopen)
break;
- /* initialize required fields */
+ /* Initialize required fields. */
cp->cn_dev = makedev(commajor, CONUNIT);
#if defined(COMCONSOLE) || defined(PCCOMCONSOLE) || !defined(__amd64__)
cp->cn_pri = CN_HIGHPRI;
@@ -1364,8 +1349,6 @@ comcnprobe(struct consdev *cp)
void
comcninit(struct consdev *cp)
{
- comconsaddr = CONADDR;
-
if (bus_space_map(comconsiot, comconsaddr, COM_NPORTS, 0, &comconsioh))
panic("comcninit: mapping failed");
@@ -1376,7 +1359,6 @@ comcninit(struct consdev *cp)
comconsinit = 0;
}
-
int
comcnattach(bus_space_tag_t iot, bus_addr_t iobase, int rate, int frequency, tcflag_t cflag)
{