svn commit: r193257 - head/sys/dev/pci

John Baldwin jhb at FreeBSD.org
Mon Jun 1 20:30:01 UTC 2009


Author: jhb
Date: Mon Jun  1 20:30:00 2009
New Revision: 193257
URL: http://svn.freebsd.org/changeset/base/193257

Log:
  Add an internal pci_printf() routine similar to device_printf() except
  that it prefixes the output with 'pci<domain>:<bus>:<device>:<function>: '.

Modified:
  head/sys/dev/pci/pci.c

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Mon Jun  1 20:27:14 2009	(r193256)
+++ head/sys/dev/pci/pci.c	Mon Jun  1 20:30:00 2009	(r193257)
@@ -76,6 +76,7 @@ static const char	*pci_maptype(uint64_t 
 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_
 	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, 
 	}
 
 	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 
 		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);


More information about the svn-src-all mailing list