From owner-p4-projects Mon Dec 30 15:30:51 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2401737B405; Mon, 30 Dec 2002 15:30:47 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AB54637B401 for ; Mon, 30 Dec 2002 15:30:46 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 551B843EA9 for ; Mon, 30 Dec 2002 15:30:46 -0800 (PST) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id gBUNUkfh009153 for ; Mon, 30 Dec 2002 15:30:46 -0800 (PST) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id gBUNUjVn009139 for perforce@freebsd.org; Mon, 30 Dec 2002 15:30:45 -0800 (PST) Date: Mon, 30 Dec 2002 15:30:45 -0800 (PST) Message-Id: <200212302330.gBUNUjVn009139@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar Subject: PERFORCE change 22956 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=22956 Change 22956 by marcel@marcel_nfs on 2002/12/30 15:30:22 Replace the debug printf() calls with calls to siodebug() and have the definition of siodebug() depend on whether SIO_DEBUG is defined. If SIO_DEBUG is not defined, we define siodebug() as an empty inline so that it gets optimized away. SIO_DEBUG is undefined by default, so the verbosity is now gone. Affected files ... .. //depot/projects/ia64/sys/dev/sio/sio.c#33 edit Differences ... ==== //depot/projects/ia64/sys/dev/sio/sio.c#33 (text+ko) ==== @@ -73,6 +73,7 @@ #include #include +#include #include #include @@ -264,6 +265,25 @@ 0, 0, sysctl_machdep_comdefaultrate, "I", ""); /* TUNABLE_INT("machdep.conspeed", &comdefaultrate); */ +#ifdef SIO_DEBUG +static void +siodebug(struct com_s *com, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + if (com != NULL) + device_print_prettyname(com->dev); + vprintf(fmt, ap); + va_end(ap); +} +#else +static __inline void +siodebug(struct com_s *com, const char *fmt, ...) +{ +} +#endif + /* * Flush the UART. Flush the transmitter FIFO and shift register first, then * flush the receiver FIFO. In this order flushing works correctly even when @@ -285,7 +305,7 @@ while ((sio_getreg(com, com_lsr) & LSR_TEMT) == 0 && --limit) DELAY(delay); if (limit == 0) { - printf("transmitter appears stuck... "); + siodebug(NULL, "transmitter appears stuck... "); return (EIO); } @@ -303,7 +323,7 @@ DELAY(5*delay); } if (limit == 0) { - printf("receiver appears broken... "); + siodebug(NULL, "receiver appears broken... "); return (EIO); } @@ -342,7 +362,7 @@ DELAY(delay); } if (limit == 0) { - printf("transmitter appears stuck"); + siodebug(NULL, "transmitter appears stuck"); return (EIO); } @@ -369,7 +389,7 @@ if (!com->hasfifo) { sio_setreg(com, com_mcr, com->reg_mcr); /* XXX barrier */ - printf("no FIFOs... "); + siodebug(NULL, "no FIFOs... "); return (0); } @@ -406,7 +426,7 @@ /* XXX barrier */ sio_setreg(com, com_mcr, com->reg_mcr); /* XXX barrier */ - printf("can't determine FIFO size... "); + siodebug(NULL, "can't determine FIFO size... "); goto fallback; } } @@ -433,11 +453,11 @@ else com->fifosize = 1; /* XXX */ - printf("count=%d; FIFO=%d... ", count, com->fifosize); + siodebug(NULL, "count=%d; FIFO=%d... ", count, com->fifosize); return (0); fallback: - printf("disabling FIFOs... "); + siodebug(NULL, "disabling FIFOs... "); com->hasfifo = 0; return (0); } @@ -607,8 +627,6 @@ int error; u_int flags; - device_printf(dev, "probing... "); - while (sio_inited != 2) if (atomic_cmpset_int(&sio_inited, 0, 1)) { mtx_init(&sio_lock, sio_driver_name, NULL, @@ -638,6 +656,8 @@ com->dev = dev; + siodebug(com, "probing... "); + /* * Perform rudimentary sanity checking and specific initialization * for non-console devices. We expect that the console device has @@ -647,7 +667,7 @@ if (com->consdev == NULL) { error = sioprobe1(com); if (error) { - printf("sanity check failed\n"); + siodebug(NULL, "sanity check failed\n"); bus_release_resource(dev, com->addr_type, com->addr_rid, com->addr_res); return (error); @@ -673,13 +693,13 @@ /* Initialize the FIFOs. */ error = sioinitfifo(com); if (error) { - printf("failed\n"); + siodebug(NULL, "failed\n"); bus_release_resource(dev, com->addr_type, com->addr_rid, com->addr_res); return (error); } - printf("ok\n"); + siodebug(NULL, "ok\n"); if (device_get_desc(dev) == NULL) siodescribe(com); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message