Module Name:    src
Committed By:   msaitoh
Date:           Fri May 23 14:16:39 UTC 2014

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

Log Message:
 Print the type of serial port from the interface field in the PCI class
register.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/com_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.22 src/sys/dev/pci/com_puc.c:1.23
--- src/sys/dev/pci/com_puc.c:1.22	Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/com_puc.c	Fri May 23 14:16:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: com_puc.c,v 1.22 2014/03/29 19:28:24 christos Exp $	*/
+/*	$NetBSD: com_puc.c,v 1.23 2014/05/23 14:16:39 msaitoh 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.22 2014/03/29 19:28:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_puc.c,v 1.23 2014/05/23 14:16:39 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -60,6 +60,17 @@ struct com_puc_softc {
 	void	*sc_ih;			/* interrupt handler */
 };
 
+/* Interface field in PCI Class register */
+static const char *serialtype[] = {
+	"Generic XT",
+	"16450",
+	"16550",
+	"16650",
+	"16750",
+	"16850",
+	"16950",
+};
+
 static int
 com_puc_probe(device_t parent, cfdata_t match, void *aux)
 {
@@ -82,10 +93,14 @@ com_puc_attach(device_t parent, device_t
 	struct puc_attach_args *aa = aux;
 	const char *intrstr;
 	char intrbuf[PCI_INTRSTR_LEN];
+	unsigned int iface;
 
 	sc->sc_dev = self;
 
+	iface = PCI_INTERFACE(pci_conf_read(aa->pc, aa->tag, PCI_CLASS_REG));
 	aprint_naive(": Serial port");
+	if (iface < __arraycount(serialtype))
+		aprint_normal(" (%s-compatible)", serialtype[iface]);
 	aprint_normal(": ");
 
 	COM_INIT_REGS(sc->sc_regs, aa->t, aa->h, aa->a);

Reply via email to