Module Name:    src
Committed By:   soren
Date:           Mon Jul 22 13:42:18 UTC 2013

Modified Files:
        src/sys/dev/pci: com_puc.c lpt_puc.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/com_puc.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/lpt_puc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/com_puc.c
diff -u src/sys/dev/pci/com_puc.c:1.19 src/sys/dev/pci/com_puc.c:1.20
--- src/sys/dev/pci/com_puc.c:1.19	Thu Nov 26 15:17:09 2009
+++ src/sys/dev/pci/com_puc.c	Mon Jul 22 13:42:17 2013
@@ -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
 
 	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
 			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);

Index: src/sys/dev/pci/lpt_puc.c
diff -u src/sys/dev/pci/lpt_puc.c:1.14 src/sys/dev/pci/lpt_puc.c:1.15
--- src/sys/dev/pci/lpt_puc.c:1.14	Fri Mar  7 17:15:52 2008
+++ src/sys/dev/pci/lpt_puc.c	Mon Jul 22 13:42:17 2013
@@ -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
 	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),

Reply via email to