svn commit: r188212 - head/sys/dev/pccard

Wojciech A. Koszek wkoszek at FreeBSD.org
Thu Feb 5 15:51:12 PST 2009


Author: wkoszek
Date: Thu Feb  5 23:51:11 2009
New Revision: 188212
URL: http://svn.freebsd.org/changeset/base/188212

Log:
  Bring consistent debugging output for all values that are supposed
  to be printed in a hexadecimal format. Otherwise, '270' doesn't say
  much.
  
  Reviewed by:	imp

Modified:
  head/sys/dev/pccard/pccard.c
  head/sys/dev/pccard/pccard_cis.c

Modified: head/sys/dev/pccard/pccard.c
==============================================================================
--- head/sys/dev/pccard/pccard.c	Thu Feb  5 23:16:33 2009	(r188211)
+++ head/sys/dev/pccard/pccard.c	Thu Feb  5 23:51:11 2009	(r188212)
@@ -173,7 +173,7 @@ pccard_set_default_descr(device_t dev)
 		if (pccard_get_product(dev, &prod))
 			return (0);
 		str = malloc(100, M_DEVBUF, M_WAITOK);
-		snprintf(str, 100, "vendor=0x%x product=0x%x", vendor, prod);
+		snprintf(str, 100, "vendor=%#x product=%#x", vendor, prod);
 		device_set_desc_copy(dev, str);
 		free(str, M_DEVBUF);
 	}
@@ -297,8 +297,8 @@ pccard_probe_and_attach_child(device_t d
 	if (pccard_function_enable(pf) == 0 &&
 	    pccard_set_default_descr(child) == 0 &&
 	    device_attach(child) == 0) {
-		DEVPRINTF((sc->dev, "function %d CCR at %d offset %x mask %x: "
-		    "%x %x %x %x, %x %x %x %x, %x\n",
+		DEVPRINTF((sc->dev, "function %d CCR at %d offset %#x "
+		    "mask %#x: %#x %#x %#x %#x, %#x %#x %#x %#x, %#x\n",
 		    pf->number, pf->pf_ccr_window, pf->pf_ccr_offset,
 		    pf->ccr_mask, pccard_ccr_read(pf, 0x00),
 		    pccard_ccr_read(pf, 0x02), pccard_ccr_read(pf, 0x04),
@@ -506,7 +506,7 @@ pccard_function_init(struct pccard_funct
 				end = start + cfe->iospace[i].length - 1;
 			else
 				end = ~0UL;
-			DEVPRINTF((bus, "I/O rid %d start %lx end %lx\n",
+			DEVPRINTF((bus, "I/O rid %d start %#lx end %#lx\n",
 			    i, start, end));
 			rid = i;
 			len = cfe->iospace[i].length;
@@ -528,7 +528,7 @@ pccard_function_init(struct pccard_funct
 				end = start + cfe->memspace[i].length - 1;
 			else
 				end = ~0UL;
-			DEVPRINTF((bus, "Memory rid %d start %lx end %lx\n",
+			DEVPRINTF((bus, "Memory rid %d start %#lx end %#lx\n",
 			    i, start, end));
 			rid = i;
 			len = cfe->memspace[i].length;
@@ -594,7 +594,7 @@ pccard_function_free(struct pccard_funct
 				device_printf(pf->sc->dev,
 				    "function_free: Resource still owned by "
 				    "child, oops. "
-				    "(type=%d, rid=%d, addr=%lx)\n",
+				    "(type=%d, rid=%d, addr=%#lx)\n",
 				    rle->type, rle->rid,
 				    rman_get_start(rle->res));
 			BUS_RELEASE_RESOURCE(device_get_parent(pf->sc->dev),
@@ -689,7 +689,7 @@ pccard_function_enable(struct pccard_fun
 		    &pf->ccr_rid, 0, ~0, PCCARD_MEM_PAGE_SIZE, RF_ACTIVE);
 		if (!pf->ccr_res)
 			goto bad;
-		DEVPRINTF((dev, "ccr_res == %lx-%lx, base=%x\n",
+		DEVPRINTF((dev, "ccr_res == %#lx-%#lx, base=%#x\n",
 		    rman_get_start(pf->ccr_res), rman_get_end(pf->ccr_res),
 		    pf->ccr_base));
 		CARD_SET_RES_FLAGS(device_get_parent(dev), dev, SYS_RES_MEMORY,
@@ -726,8 +726,8 @@ pccard_function_enable(struct pccard_fun
 	if (pccard_debug) {
 		STAILQ_FOREACH(tmp, &pf->sc->card.pf_head, pf_list) {
 			device_printf(tmp->sc->dev,
-			    "function %d CCR at %d offset %x: "
-			    "%x %x %x %x, %x %x %x %x, %x\n",
+			    "function %d CCR at %d offset %#x: "
+			    "%#x %#x %#x %#x, %#x %#x %#x %#x, %#x\n",
 			    tmp->number, tmp->pf_ccr_window,
 			    tmp->pf_ccr_offset,
 			    pccard_ccr_read(tmp, 0x00),
@@ -1185,7 +1185,7 @@ pccard_release_resource(device_t dev, de
 
 	if (!rle) {
 		device_printf(dev, "Allocated resource not found, "
-		    "%d %x %lx %lx\n",
+		    "%d %#x %#lx %#lx\n",
 		    type, rid, rman_get_start(r), rman_get_size(r));
 		return ENOENT;
 	}

Modified: head/sys/dev/pccard/pccard_cis.c
==============================================================================
--- head/sys/dev/pccard/pccard_cis.c	Thu Feb  5 23:16:33 2009	(r188211)
+++ head/sys/dev/pccard/pccard_cis.c	Thu Feb  5 23:51:11 2009	(r188212)
@@ -151,7 +151,7 @@ pccard_scan_cis(device_t bus, device_t d
 	tuple.memh = rman_get_bushandle(res);
 	tuple.ptr = 0;
 
-	DPRINTF(("cis mem map 0x%x (resource: 0x%lx)\n",
+	DPRINTF(("cis mem map %#x (resource: %#lx)\n",
 	    (unsigned int) tuple.memh, rman_get_start(res)));
 
 	tuple.mult = 2;
@@ -230,7 +230,7 @@ pccard_scan_cis(device_t bus, device_t d
 				longlink_common = (tuple.code ==
 				    CISTPL_LONGLINK_C) ? 1 : 0;
 				longlink_addr = pccard_tuple_read_4(&tuple, 0);
-				DPRINTF(("CISTPL_LONGLINK_%s %lx\n",
+				DPRINTF(("CISTPL_LONGLINK_%s %#lx\n",
 				    longlink_common ? "C" : "A",
 				    longlink_addr));
 				break;
@@ -264,8 +264,8 @@ pccard_scan_cis(device_t bus, device_t d
 
 					addr = tuple.ptr + offset;
 
-					DPRINTF(("CISTPL_CHECKSUM addr=%lx "
-					    "len=%lx cksum=%x",
+					DPRINTF(("CISTPL_CHECKSUM addr=%#lx "
+					    "len=%#lx cksum=%#x",
 					    addr, length, cksum));
 
 					/*
@@ -286,7 +286,7 @@ pccard_scan_cis(device_t bus, device_t d
 						    tuple.memh,
 						    addr + tuple.mult * i);
 					if (cksum != (sum & 0xff)) {
-						DPRINTF((" failed sum=%x\n",
+						DPRINTF((" failed sum=%#x\n",
 						    sum));
 						device_printf(dev, 
 						    "CIS checksum failed\n");
@@ -361,7 +361,7 @@ pccard_scan_cis(device_t bus, device_t d
 						mfc[i].addr =
 						    pccard_tuple_read_4(&tuple,
 						    1 + 5 * i + 1);
-						DPRINTF((" %s:%lx",
+						DPRINTF((" %s:%#lx",
 						    mfc[i].common ? "common" :
 						    "attr", mfc[i].addr));
 					}
@@ -386,11 +386,11 @@ pccard_scan_cis(device_t bus, device_t d
 			{
 				int i;
 
-				DPRINTF((" %02x %02x", tuple.code,
+				DPRINTF((" %#02x %#02x", tuple.code,
 				    tuple.length));
 
 				for (i = 0; i < tuple.length; i++) {
-					DPRINTF((" %02x",
+					DPRINTF((" %#02x",
 					    pccard_tuple_read_1(&tuple, i)));
 					if ((i % 16) == 13)
 						DPRINTF(("\n"));
@@ -416,7 +416,7 @@ pccard_scan_cis(device_t bus, device_t d
 				CARD_SET_RES_FLAGS(bus, dev, SYS_RES_MEMORY,
 				    rid, longlink_common ?
 				    PCCARD_A_MEM_COM : PCCARD_A_MEM_ATTR);
-				DPRINTF(("cis mem map %x\n",
+				DPRINTF(("cis mem map %#x\n",
 				    (unsigned int) tuple.memh));
 				tuple.mult = longlink_common ? 1 : 2;
 				tuple.ptr = longlink_addr;
@@ -427,7 +427,7 @@ pccard_scan_cis(device_t bus, device_t d
 				CARD_SET_RES_FLAGS(bus, dev, SYS_RES_MEMORY,
 				    rid, mfc[mfc_index].common ?
 				    PCCARD_A_MEM_COM : PCCARD_A_MEM_ATTR);
-				DPRINTF(("cis mem map %x\n",
+				DPRINTF(("cis mem map %#x\n",
 				    (unsigned int) tuple.memh));
 				/* set parse state, and point at the next one */
 				tuple.mult = mfc[mfc_index].common ? 1 : 2;
@@ -441,7 +441,7 @@ pccard_scan_cis(device_t bus, device_t d
 			tuple.code = pccard_cis_read_1(&tuple, tuple.ptr);
 			if (tuple.code != CISTPL_LINKTARGET) {
 				DPRINTF(("CISTPL_LINKTARGET expected, "
-				    "code %02x observed\n", tuple.code));
+				    "code %#02x observed\n", tuple.code));
 				continue;
 			}
 			tuple.length = pccard_cis_read_1(&tuple, tuple.ptr + 1);
@@ -504,7 +504,7 @@ pccard_print_cis(device_t dev)
 	}
 	printf("\n");
 
-	device_printf(dev, "Manufacturer code 0x%x, product 0x%x\n",
+	device_printf(dev, "Manufacturer code %#x, product %#x\n",
 	    card->manufacturer, card->product);
 
 	STAILQ_FOREACH(pf, &card->pf_head, pf_list) {
@@ -552,7 +552,7 @@ pccard_print_cis(device_t dev)
 			break;
 		}
 
-		printf(", ccr addr %x mask %x\n", pf->ccr_base, pf->ccr_mask);
+		printf(", ccr addr %#x mask %#x\n", pf->ccr_base, pf->ccr_mask);
 
 		STAILQ_FOREACH(cfe, &pf->cfe_head, cfe_list) {
 			device_printf(dev, "function %d, config table entry "
@@ -570,15 +570,15 @@ pccard_print_cis(device_t dev)
 				break;
 			}
 
-			printf("; irq mask %x", cfe->irqmask);
+			printf("; irq mask %#x", cfe->irqmask);
 
 			if (cfe->num_iospace) {
-				printf("; iomask %lx, iospace", cfe->iomask);
+				printf("; iomask %#lx, iospace", cfe->iomask);
 
 				for (i = 0; i < cfe->num_iospace; i++) {
-					printf(" %lx", cfe->iospace[i].start);
+					printf(" %#lx", cfe->iospace[i].start);
 					if (cfe->iospace[i].length)
-						printf("-%lx",
+						printf("-%#lx",
 						    cfe->iospace[i].start +
 						    cfe->iospace[i].length - 1);
 				}
@@ -587,14 +587,14 @@ pccard_print_cis(device_t dev)
 				printf("; memspace");
 
 				for (i = 0; i < cfe->num_memspace; i++) {
-					printf(" %lx",
+					printf(" %#lx",
 					    cfe->memspace[i].cardaddr);
 					if (cfe->memspace[i].length)
-						printf("-%lx",
+						printf("-%#lx",
 						    cfe->memspace[i].cardaddr +
 						    cfe->memspace[i].length - 1);
 					if (cfe->memspace[i].hostaddr)
-						printf("@%lx",
+						printf("@%#lx",
 						    cfe->memspace[i].hostaddr);
 				}
 			}
@@ -1264,7 +1264,7 @@ pccard_parse_cis_tuple(const struct pcca
 		DPRINTF(("CISTPL_CFTABLE_ENTRY\n"));
 		break;
 	default:
-		DPRINTF(("unhandled CISTPL %x\n", tuple->code));
+		DPRINTF(("unhandled CISTPL %#x\n", tuple->code));
 		break;
 	}
 


More information about the svn-src-head mailing list