Module Name: src Committed By: drochner Date: Thu Jan 26 21:17:28 UTC 2012
Modified Files: src/sys/dev/pci: pci_subr.c pcivar.h ppb.c Log Message: 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) To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/dev/pci/pci_subr.c cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pci/pcivar.h cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/ppb.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/pci_subr.c diff -u src/sys/dev/pci/pci_subr.c:1.88 src/sys/dev/pci/pci_subr.c:1.89 --- src/sys/dev/pci/pci_subr.c:1.88 Wed Aug 17 00:59:47 2011 +++ src/sys/dev/pci/pci_subr.c Thu Jan 26 21:17:28 2012 @@ -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 @@ pci_devinfo(pcireg_t id_reg, pcireg_t cl } } +#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: Index: src/sys/dev/pci/pcivar.h diff -u src/sys/dev/pci/pcivar.h:1.96 src/sys/dev/pci/pcivar.h:1.97 --- src/sys/dev/pci/pcivar.h:1.96 Fri Oct 21 21:35:28 2011 +++ src/sys/dev/pci/pcivar.h Thu Jan 26 21:17:28 2012 @@ -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 pci_probe_device(struct pci_softc *, 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 * Index: src/sys/dev/pci/ppb.c diff -u src/sys/dev/pci/ppb.c:1.47 src/sys/dev/pci/ppb.c:1.48 --- src/sys/dev/pci/ppb.c:1.47 Fri Oct 21 21:35:28 2011 +++ src/sys/dev/pci/ppb.c Thu Jan 26 21:17:28 2012 @@ -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 @@ ppbattach(device_t parent, device_t self 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;