diff options
author | jhb <jhb@FreeBSD.org> | 2009-06-01 20:30:00 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-06-01 20:30:00 +0000 |
commit | 4de098dcff0521a696f66b04f02d9bd55fc7e452 (patch) | |
tree | f74ddedc459cc189fece16d7b637bbcd08f692bd /sys/dev | |
parent | 0247ab91bfd736f37b70600ba31cced5b6d2a697 (diff) | |
download | FreeBSD-src-4de098dcff0521a696f66b04f02d9bd55fc7e452.zip FreeBSD-src-4de098dcff0521a696f66b04f02d9bd55fc7e452.tar.gz |
Add an internal pci_printf() routine similar to device_printf() except
that it prefixes the output with 'pci<domain>:<bus>:<device>:<function>: '.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/pci.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 3b330c7..5055762 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -76,6 +76,7 @@ static const char *pci_maptype(uint64_t mapreg); static int pci_mapsize(uint64_t testval); static int pci_maprange(uint64_t mapreg); static void pci_fixancient(pcicfgregs *cfg); +static int pci_printf(pcicfgregs *cfg, const char *fmt, ...); static int pci_porten(device_t dev); static int pci_memen(device_t dev); @@ -313,6 +314,20 @@ pci_find_device(uint16_t vendor, uint16_t device) return (NULL); } +static int +pci_printf(pcicfgregs *cfg, const char *fmt, ...) +{ + va_list ap; + int retval; + + retval = printf("pci%d:%d:%d:%d: ", cfg->domain, cfg->bus, cfg->slot, + cfg->func); + va_start(ap, fmt); + retval += vprintf(fmt, ap); + va_end(ap); + return (retval); +} + /* return base address of memory or port map */ static pci_addr_t @@ -2049,10 +2064,8 @@ pci_set_powerstate_method(device_t dev, device_t child, int state) } if (bootverbose) - printf( - "pci%d:%d:%d:%d: Transition from D%d to D%d\n", - dinfo->cfg.domain, dinfo->cfg.bus, dinfo->cfg.slot, - dinfo->cfg.func, oldstate, state); + pci_printf(cfg, "Transition from D%d to D%d\n", oldstate, + state); PCI_WRITE_CONFIG(dev, child, cfg->pp.pp_status, status, 2); if (delay) @@ -2815,9 +2828,7 @@ pci_driver_added(device_t dev, driver_t *driver) dinfo = device_get_ivars(child); pci_print_verbose(dinfo); if (bootverbose) - printf("pci%d:%d:%d:%d: reprobing on driver added\n", - dinfo->cfg.domain, dinfo->cfg.bus, dinfo->cfg.slot, - dinfo->cfg.func); + pci_printf(&dinfo->cfg, "reprobing on driver added\n"); pci_cfg_restore(child, dinfo); if (device_probe_and_attach(child) != 0) pci_cfg_save(child, dinfo, 1); |