Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Since puc(4) serial ports are typically not iden...



details:   https://anonhg.NetBSD.org/src/rev/844ba750096c
branches:  trunk
changeset: 788827:844ba750096c
user:      soren <soren%NetBSD.org@localhost>
date:      Mon Jul 22 13:42:17 2013 +0000

description:
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:

 sys/dev/pci/com_puc.c |  42 +++++++++++++++++++++++-------------------
 sys/dev/pci/lpt_puc.c |   7 +++++--
 2 files changed, 28 insertions(+), 21 deletions(-)

diffs (109 lines):

diff -r 62b204f976a6 -r 844ba750096c sys/dev/pci/com_puc.c
--- a/sys/dev/pci/com_puc.c     Mon Jul 22 13:40:36 2013 +0000
+++ b/sys/dev/pci/com_puc.c     Mon Jul 22 13:42:17 2013 +0000
@@ -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 @@
 
        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 @@
                        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 -r 62b204f976a6 -r 844ba750096c sys/dev/pci/lpt_puc.c
--- a/sys/dev/pci/lpt_puc.c     Mon Jul 22 13:40:36 2013 +0000
+++ b/sys/dev/pci/lpt_puc.c     Mon Jul 22 13:42:17 2013 +0000
@@ -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 @@
        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),



Home | Main Index | Thread Index | Old Index