summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2008-04-30 13:59:34 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2008-04-30 13:59:34 +0000
commit5824f2fa0be430951bedb7614b013d55b42681aa (patch)
treeaf48251f5d814a38b643597209e2b3bb1916e598 /sys/arch/amd64
parent9c7289cb79e29eac6e48dc178ba2a4b756ade788 (diff)
fix serial console handling on amd64. currently only glass console ever
works, even if the boot loader is configured to use serial console. after the changes jsing and i made, the initial probe of the serial port was failing since the default base addres for the port is invalid. cos of that the kernel would only ever consider the glass console for use. this fixes it by reprobing the serial port if we get any config for it from the boot loader. advice on aesthetics from miod@ advice and ok from kettenis@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/conf.c4
-rw-r--r--sys/arch/amd64/amd64/consinit.c9
-rw-r--r--sys/arch/amd64/amd64/machdep.c36
3 files changed, 22 insertions, 27 deletions
diff --git a/sys/arch/amd64/amd64/conf.c b/sys/arch/amd64/amd64/conf.c
index 0d0cfbd60ad..02f89f38b81 100644
--- a/sys/arch/amd64/amd64/conf.c
+++ b/sys/arch/amd64/amd64/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.18 2008/04/08 14:31:54 claudio Exp $ */
+/* $OpenBSD: conf.c,v 1.19 2008/04/30 13:59:32 dlg Exp $ */
/*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
@@ -446,7 +446,7 @@ struct consdev constab[] = {
#if 1 || NWSDISPLAY > 0
cons_init(ws),
#endif
-#if NCOM + NPCCOM > 0
+#if NCOM > 0
cons_init(com),
#endif
{ 0 },
diff --git a/sys/arch/amd64/amd64/consinit.c b/sys/arch/amd64/amd64/consinit.c
index 7f051dc4306..10edb215b2a 100644
--- a/sys/arch/amd64/amd64/consinit.c
+++ b/sys/arch/amd64/amd64/consinit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: consinit.c,v 1.3 2004/11/02 21:20:58 miod Exp $ */
+/* $OpenBSD: consinit.c,v 1.4 2008/04/30 13:59:32 dlg Exp $ */
/* $NetBSD: consinit.c,v 1.2 2003/03/02 18:27:14 fvdl Exp $ */
/*
@@ -37,10 +37,5 @@
void
consinit()
{
- static int initted;
-
- if (initted)
- return;
- initted = 1;
- cninit();
+ /* already done in machdep.c */
}
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 57ba0eed1c1..8c99f42b4e9 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.73 2008/04/25 11:30:22 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.74 2008/04/30 13:59:33 dlg Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -143,6 +143,12 @@
#include <dev/acpi/acpivar.h>
#endif
+#include "com.h"
+#if NCOM > 0
+#include <sys/tty.h>
+#include <dev/ic/comvar.h>
+#include <dev/ic/comreg.h>
+#endif
/* the following is used externally (sysctl_hw) */
char machine[] = MACHINE;
@@ -1174,7 +1180,6 @@ extern vector *IDTVEC(exceptions)[];
void
init_x86_64(paddr_t first_avail)
{
- extern void consinit(void);
extern struct extent *iomem_ex;
struct region_descriptor region;
struct mem_segment_descriptor *ldt_segp;
@@ -1189,17 +1194,16 @@ init_x86_64(paddr_t first_avail)
x86_bus_space_init();
- consinit(); /* XXX SHOULD NOT BE DONE HERE */
+ /*
+ * Attach the glass console early in case we need to display a panic.
+ */
+ cninit();
/*
* Initailize PAGE_SIZE-dependent variables.
*/
uvm_setpagesize();
-#if 0
- uvmexp.ncolors = 2;
-#endif
-
/*
* Boot arguments are in a single page specified by /boot.
*
@@ -1813,21 +1817,17 @@ getbootinfo(char *bootinfo, int bootinfo_size)
if (q->ba_size >= sizeof(bios_consdev_t)) {
bios_consdev_t *cdp =
(bios_consdev_t*)q->ba_arg;
-#include "com.h"
#if NCOM > 0
static const int ports[] =
{ 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
- if (major(cdp->consdev) == 8) {
- int unit = minor(cdp->consdev);
- /* ic/com.c */
- extern int comconsrate;
- extern int comconsaddr;
-
- if (unit >= 0 && unit <
- (sizeof(ports) / sizeof(ports[0])))
- comconsaddr = ports[unit];
-
+ int unit = minor(cdp->consdev);
+ if (major(cdp->consdev) == 8 && unit >= 0 &&
+ unit < (sizeof(ports)/sizeof(ports[0]))) {
+ comconsaddr = ports[unit];
comconsrate = cdp->conspeed;
+
+ /* Probe the serial port this time. */
+ cninit();
}
#endif
#ifdef BOOTINFO_DEBUG