Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Print the type of serial port from the interface...



details:   https://anonhg.NetBSD.org/src/rev/ab6cf7222be6
branches:  trunk
changeset: 329416:ab6cf7222be6
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri May 23 14:16:39 2014 +0000

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

diffstat:

 sys/dev/pci/com_puc.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r 82a7f4b23bb1 -r ab6cf7222be6 sys/dev/pci/com_puc.c
--- a/sys/dev/pci/com_puc.c     Fri May 23 13:57:04 2014 +0000
+++ b/sys/dev/pci/com_puc.c     Fri May 23 14:16:39 2014 +0000
@@ -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 @@
        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 @@
        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);



Home | Main Index | Thread Index | Old Index