Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci extend the pci_aprint_devinfo slightly to cover ...



details:   https://anonhg.NetBSD.org/src/rev/1688254556f5
branches:  trunk
changeset: 773228:1688254556f5
user:      drochner <drochner%NetBSD.org@localhost>
date:      Sun Jan 29 11:31:38 2012 +0000

description:
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump

diffstat:

 sys/dev/pci/pci_subr.c |  27 ++++++++++++++++++++-------
 sys/dev/pci/pcivar.h   |   7 +++++--
 sys/dev/pci/ppb.c      |   6 +++---
 3 files changed, 28 insertions(+), 12 deletions(-)

diffs (99 lines):

diff -r fa43034fa264 -r 1688254556f5 sys/dev/pci/pci_subr.c
--- a/sys/dev/pci/pci_subr.c    Sun Jan 29 11:14:49 2012 +0000
+++ b/sys/dev/pci/pci_subr.c    Sun Jan 29 11:31:38 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_subr.c,v 1.89 2012/01/26 21:17:28 drochner Exp $   */
+/*     $NetBSD: pci_subr.c,v 1.90 2012/01/29 11:31:38 drochner Exp $   */
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.89 2012/01/26 21:17:28 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.90 2012/01/29 11:31:38 drochner Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -423,14 +423,27 @@
 
 #ifdef _KERNEL
 void
-pci_aprint_devinfo(const struct pci_attach_args *pa)
+pci_aprint_devinfo_fancy(const struct pci_attach_args *pa, const char *naive,
+                        const char *known, int addrev)
 {
        char devinfo[256];
 
-       pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo));
-       aprint_normal(": %s (rev. 0x%02x)\n", devinfo,
-                     PCI_REVISION(pa->pa_class));
-       aprint_naive("\n");
+       if (known) {
+               aprint_normal(": %s", known);
+               if (addrev)
+                       aprint_normal(" (rev. 0x%02x)",
+                                     PCI_REVISION(pa->pa_class));
+               aprint_normal("\n");
+       } else {
+               pci_devinfo(pa->pa_id, pa->pa_class, 0,
+                           devinfo, sizeof(devinfo));
+               aprint_normal(": %s (rev. 0x%02x)\n", devinfo,
+                             PCI_REVISION(pa->pa_class));
+       }
+       if (naive)
+               aprint_naive(": %s\n", naive);
+       else
+               aprint_naive("\n");
 }
 #endif
 
diff -r fa43034fa264 -r 1688254556f5 sys/dev/pci/pcivar.h
--- a/sys/dev/pci/pcivar.h      Sun Jan 29 11:14:49 2012 +0000
+++ b/sys/dev/pci/pcivar.h      Sun Jan 29 11:31:38 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcivar.h,v 1.97 2012/01/26 21:17:28 drochner Exp $     */
+/*     $NetBSD: pcivar.h,v 1.98 2012/01/29 11:31:38 drochner Exp $     */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -283,7 +283,10 @@
            int (*)(const struct pci_attach_args *),
            struct pci_attach_args *);
 void   pci_devinfo(pcireg_t, pcireg_t, int, char *, size_t);
-void   pci_aprint_devinfo(const struct pci_attach_args *);
+void   pci_aprint_devinfo_fancy(const struct pci_attach_args *,
+                                const char *, const char *, int);
+#define pci_aprint_devinfo(pap, naive) \
+       pci_aprint_devinfo_fancy(pap, naive, NULL, 0);
 void   pci_conf_print(pci_chipset_tag_t, pcitag_t,
            void (*)(pci_chipset_tag_t, pcitag_t, const pcireg_t *));
 const struct pci_quirkdata *
diff -r fa43034fa264 -r 1688254556f5 sys/dev/pci/ppb.c
--- a/sys/dev/pci/ppb.c Sun Jan 29 11:14:49 2012 +0000
+++ b/sys/dev/pci/ppb.c Sun Jan 29 11:31:38 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ppb.c,v 1.48 2012/01/26 21:17:28 drochner Exp $        */
+/*     $NetBSD: ppb.c,v 1.49 2012/01/29 11:31:38 drochner Exp $        */
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.48 2012/01/26 21:17:28 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.49 2012/01/29 11:31:38 drochner Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -159,7 +159,7 @@
        struct pcibus_attach_args pba;
        pcireg_t busdata;
 
-       pci_aprint_devinfo(pa);
+       pci_aprint_devinfo(pa, NULL);
 
        sc->sc_pc = pc;
        sc->sc_tag = pa->pa_tag;



Home | Main Index | Thread Index | Old Index