Module Name: src Committed By: drochner Date: Sun Jan 29 11:31:38 UTC 2012
Modified Files: src/sys/dev/pci: pci_subr.c pcivar.h ppb.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/dev/pci/pci_subr.c cvs rdiff -u -r1.97 -r1.98 src/sys/dev/pci/pcivar.h cvs rdiff -u -r1.48 -r1.49 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.89 src/sys/dev/pci/pci_subr.c:1.90 --- src/sys/dev/pci/pci_subr.c:1.89 Thu Jan 26 21:17:28 2012 +++ src/sys/dev/pci/pci_subr.c Sun Jan 29 11:31:38 2012 @@ -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 @@ pci_devinfo(pcireg_t id_reg, pcireg_t cl #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 Index: src/sys/dev/pci/pcivar.h diff -u src/sys/dev/pci/pcivar.h:1.97 src/sys/dev/pci/pcivar.h:1.98 --- src/sys/dev/pci/pcivar.h:1.97 Thu Jan 26 21:17:28 2012 +++ src/sys/dev/pci/pcivar.h Sun Jan 29 11:31:38 2012 @@ -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 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_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 * Index: src/sys/dev/pci/ppb.c diff -u src/sys/dev/pci/ppb.c:1.48 src/sys/dev/pci/ppb.c:1.49 --- src/sys/dev/pci/ppb.c:1.48 Thu Jan 26 21:17:28 2012 +++ src/sys/dev/pci/ppb.c Sun Jan 29 11:31:38 2012 @@ -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 @@ ppbattach(device_t parent, device_t self 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;