Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci put printing of the pci_devinfo into its own fun...



details:   https://anonhg.NetBSD.org/src/rev/16609397db8d
branches:  trunk
changeset: 773066:16609397db8d
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu Jan 26 21:17:28 2012 +0000

description:
put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)

diffstat:

 sys/dev/pci/pci_subr.c |  17 +++++++++++++++--
 sys/dev/pci/pcivar.h   |   3 ++-
 sys/dev/pci/ppb.c      |  10 +++-------
 3 files changed, 20 insertions(+), 10 deletions(-)

diffs (87 lines):

diff -r b4c07d59d335 -r 16609397db8d sys/dev/pci/pci_subr.c
--- a/sys/dev/pci/pci_subr.c    Thu Jan 26 21:11:27 2012 +0000
+++ b/sys/dev/pci/pci_subr.c    Thu Jan 26 21:17:28 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_subr.c,v 1.88 2011/08/17 00:59:47 dyoung Exp $     */
+/*     $NetBSD: pci_subr.c,v 1.89 2012/01/26 21:17:28 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.88 2011/08/17 00:59:47 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.89 2012/01/26 21:17:28 drochner Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -421,6 +421,19 @@
        }
 }
 
+#ifdef _KERNEL
+void
+pci_aprint_devinfo(const struct pci_attach_args *pa)
+{
+       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");
+}
+#endif
+
 /*
  * Print out most of the PCI configuration registers.  Typically used
  * in a device attach routine like this:
diff -r b4c07d59d335 -r 16609397db8d sys/dev/pci/pcivar.h
--- a/sys/dev/pci/pcivar.h      Thu Jan 26 21:11:27 2012 +0000
+++ b/sys/dev/pci/pcivar.h      Thu Jan 26 21:17:28 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcivar.h,v 1.96 2011/10/21 21:35:28 dyoung Exp $       */
+/*     $NetBSD: pcivar.h,v 1.97 2012/01/26 21:17:28 drochner Exp $     */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -283,6 +283,7 @@
            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_conf_print(pci_chipset_tag_t, pcitag_t,
            void (*)(pci_chipset_tag_t, pcitag_t, const pcireg_t *));
 const struct pci_quirkdata *
diff -r b4c07d59d335 -r 16609397db8d sys/dev/pci/ppb.c
--- a/sys/dev/pci/ppb.c Thu Jan 26 21:11:27 2012 +0000
+++ b/sys/dev/pci/ppb.c Thu Jan 26 21:17:28 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ppb.c,v 1.47 2011/10/21 21:35:28 dyoung Exp $  */
+/*     $NetBSD: ppb.c,v 1.48 2012/01/26 21:17:28 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.47 2011/10/21 21:35:28 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.48 2012/01/26 21:17:28 drochner Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -158,12 +158,8 @@
        pci_chipset_tag_t pc = pa->pa_pc;
        struct pcibus_attach_args pba;
        pcireg_t busdata;
-       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");
+       pci_aprint_devinfo(pa);
 
        sc->sc_pc = pc;
        sc->sc_tag = pa->pa_tag;



Home | Main Index | Thread Index | Old Index