summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorsoren <soren@NetBSD.org>2013-07-22 13:42:17 +0000
committersoren <soren@NetBSD.org>2013-07-22 13:42:17 +0000
commit769cf7082eb76fbe7af4f05668648ed9d2a07682 (patch)
tree10985ffd3f772b2074a36785dd33b9ce49265fca /sys/dev
parentbd972b9ac790f935d94175af36d40602b8a92b60 (diff)
Since puc(4) serial ports are typically not identified in the
BIOS COM[1234] table, the I/O address must be manually set using installboot(8) in order to enable a serial console. Print the address here so the user doesn't have to dig through PCI configuration space to find it. Enable suspend/resume hooks.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/com_puc.c42
-rw-r--r--sys/dev/pci/lpt_puc.c7
2 files changed, 28 insertions, 21 deletions
diff --git a/sys/dev/pci/com_puc.c b/sys/dev/pci/com_puc.c
index 96f65ca1a73..684b7f4d5c7 100644
--- a/sys/dev/pci/com_puc.c
+++ b/sys/dev/pci/com_puc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com_puc.c,v 1.19 2009/11/26 15:17:09 njoly Exp $ */
+/* $NetBSD: com_puc.c,v 1.20 2013/07/22 13:42:17 soren Exp $ */
/*
* Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com_puc.c,v 1.19 2009/11/26 15:17:09 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_puc.c,v 1.20 2013/07/22 13:42:17 soren Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -84,21 +84,8 @@ com_puc_attach(device_t parent, device_t self, void *aux)
sc->sc_dev = self;
- /*
- * XXX This driver assumes that 'com' ports attached to 'puc'
- * XXX can not be console. That isn't unreasonable, because PCI
- * XXX devices are supposed to be dynamically mapped, and com
- * XXX console ports want fixed addresses. When/if baseboard
- * XXX 'com' ports are identified as PCI/communications/serial
- * XXX devices and are known to be mapped at the standard
- * XXX addresses, if they can be the system console then we have
- * XXX to cope with doing the mapping right. Then this will get
- * XXX really ugly. Of course, by then we might know the real
- * XXX definition of PCI/communications/serial, and attach 'com'
- * XXX directly on PCI.
- */
-
- aprint_naive(": Serial port\n");
+ aprint_naive(": Serial port");
+ aprint_normal(": ");
COM_INIT_REGS(sc->sc_regs, aa->t, aa->h, aa->a);
sc->sc_frequency = aa->flags & PUC_COM_CLOCKMASK;
@@ -116,19 +103,36 @@ com_puc_attach(device_t parent, device_t self, void *aux)
write_siig10x_usrreg(aa->pc, aa->tag, usrregno, 1);
else
write_siig20x_usrreg(aa->pc, aa->tag, usrregno, 1);
+ } else {
+ if (!pmf_device_register(self, NULL, com_resume))
+ aprint_error_dev(self,
+ "couldn't establish power handler\n");
}
intrstr = pci_intr_string(aa->pc, aa->intrhandle);
psc->sc_ih = pci_intr_establish(aa->pc, aa->intrhandle, IPL_SERIAL,
comintr, sc);
if (psc->sc_ih == NULL) {
- aprint_error(": couldn't establish interrupt");
+ aprint_error("couldn't establish interrupt");
if (intrstr != NULL)
aprint_error(" at %s", intrstr);
aprint_error("\n");
return;
}
- aprint_normal(": interrupting at %s\n", intrstr);
+
+#if defined(amd64) || defined(i386)
+ /*
+ * Since puc(4) serial ports are typically not identified in the
+ * BIOS COM[1234] table, the I/O address must be manually set using
+ * installboot(8) in order to enable a serial console.
+ * Print the address here so the user doesn't have to dig through
+ * PCI configuration space to find it.
+ */
+ if (aa->h < 0x10000)
+ aprint_normal("ioaddr 0x%04lx, ", aa->h);
+#endif
+
+ aprint_normal("interrupting at %s\n", intrstr);
aprint_normal("%s", device_xname(self));
com_attach_subr(sc);
diff --git a/sys/dev/pci/lpt_puc.c b/sys/dev/pci/lpt_puc.c
index efbb383f71f..45ec64054e4 100644
--- a/sys/dev/pci/lpt_puc.c
+++ b/sys/dev/pci/lpt_puc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lpt_puc.c,v 1.14 2008/03/07 17:15:52 cube Exp $ */
+/* $NetBSD: lpt_puc.c,v 1.15 2013/07/22 13:42:17 soren Exp $ */
/*
* Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lpt_puc.c,v 1.14 2008/03/07 17:15:52 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lpt_puc.c,v 1.15 2013/07/22 13:42:17 soren Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -88,6 +88,9 @@ lpt_puc_attach(device_t parent, device_t self, void *aux)
aprint_normal(": interrupting at %s\n", intrstr);
lpt_attach_subr(sc);
+
+ if (!pmf_device_register(self, NULL, NULL))
+ aprint_error_dev(self, "couldn't establish power handler\n");
}
CFATTACH_DECL_NEW(lpt_puc, sizeof(struct lpt_softc),