summaryrefslogtreecommitdiff
path: root/sys
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
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')
-rw-r--r--sys/arch/sgi/include/autoconf.h10
-rw-r--r--sys/arch/sgi/sgi/ip32_machdep.c12
-rw-r--r--sys/dev/ic/com.c36
3 files changed, 18 insertions, 40 deletions
diff --git a/sys/arch/sgi/include/autoconf.h b/sys/arch/sgi/include/autoconf.h
index 10e9ed351b3..b9f446445e6 100644
--- a/sys/arch/sgi/include/autoconf.h
+++ b/sys/arch/sgi/include/autoconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.h,v 1.13 2008/04/07 22:32:46 miod Exp $ */
+/* $OpenBSD: autoconf.h,v 1.14 2008/04/24 12:29:34 jsing Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -71,14 +71,6 @@ struct sys_rec {
extern struct sys_rec sys_config;
-/*
- * Give com.c method to find console address and speeds
- */
-#define COM_FREQ (sys_config.cons_baudclk)
-#define CONCOM_FREQ (sys_config.cons_baudclk)
-#define CONADDR (sys_config.cons_ioaddr)
-
-
/**/
struct confargs;
diff --git a/sys/arch/sgi/sgi/ip32_machdep.c b/sys/arch/sgi/sgi/ip32_machdep.c
index 0fc18b4a411..93a273b5645 100644
--- a/sys/arch/sgi/sgi/ip32_machdep.c
+++ b/sys/arch/sgi/sgi/ip32_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip32_machdep.c,v 1.1 2008/04/07 22:32:46 miod Exp $ */
+/* $OpenBSD: ip32_machdep.c,v 1.2 2008/04/24 12:29:34 jsing Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -48,6 +48,10 @@ void crime_configure_memory(void);
extern int bootdriveoffs;
+extern bus_addr_t comconsaddr;
+extern bus_space_tag_t comconsiot;
+extern int comconsfreq;
+
void
crime_configure_memory(void)
{
@@ -134,7 +138,7 @@ ip32_setup()
break;
}
- sys_config.cons_ioaddr = MACE_ISA_SER1_OFFS;
- sys_config.cons_baudclk = 1843200; /*XXX*/
- sys_config.cons_iot = &macebus_tag;
+ comconsaddr = MACE_ISA_SER1_OFFS;
+ comconsfreq = 1843200;
+ comconsiot = &macebus_tag;
}
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)
{