Subject: Re: Adding bootverbose
To: None <,>
From: Chris Torek <torek@BSDI.COM>
List: tech-kern
Date: 07/10/2000 19:20:24
Just FYI, BSD/OS has four (!) levels, all set by the -autodebug
parameter to boot:

	-autodebug -d

Debug mode.  Enormously verbose; useful for "why doesn't this
configuration work" problems.  (More useful for binary-only systems
than source, really.)

	-autodebug -q

Quiet mode.  One line per device that says something inocuous like:
"com0 at isa0: serial port" or "de0 at pci0: Ethernet".  Good for
naive users who just want to know that the Ethernet card they stuck
in is showing up, and have no idea what the differences between a
3C905 and 3C905 and 3C905B and ... are.

	(no flags)

Default "normal" mode, pretty much what we get today.

	-autodebug -v

Verbose mode.  Print whatever detailed info the driver writer thought
was relevant (e.g., which chip the 3C905 has this nanosecond), but not
as chatty as -d.

There are -a and -p flags for the i386 as well (see below).

These are all done inside driver files with calls to:

	printf		(stuff that comes out in all modes)
	aprint_debug	(debug-only info)
	aprint_naive	(stuff that comes out only for -q)
	aprint_normal	(stuff that gets suppressed by -q)
	aprint_verbose	(stuff that comes out only for -v)

For instance, the BSD/OS "aic" driver has, in effect, in aicattach():

	aprint_debug("%s: external cable %spresent\n",
	    sc->sc_xname, external ? "" : "not ");
	aprint_debug("%s: internal 50 pin cable %spresent\n",
	    sc->sc_xname, internal_50 ? "" : "not ");
	aprint_verbose("%s: initiator id %d parity ", sc->sc_xname, sc->sc_id);
	if ((sc->sc_parity = getparm(sc->sc_xname, PARM4_AIC_PARITY, ~0)) != 0)
	if ((sc->sc_activeneg = getparm(sc->sc_xname, PARM4_AIC_ACTNEG, 1)))
		aprint_verbose(", active negation enabled\n");
		aprint_verbose(", active negation disabled\n");

This all seems to work pretty well.

The -autodebug flags are passed as boot parameter B_AUTODEBUG:

#define	B_AUTODEBUG	5	/* int: autoconfiguration debug value */
#define	    AC_DEBUG	0x01	    /* -d print debug per probe, page output */
#define	    AC_ASK	0x02	    /* -a ask/print debug per device probe */
#define	    AC_QUIET	0x04	    /* -q quieter per-device autoconf output */
#define	    AC_VERBOSE	0x08	    /* -v verbose per-device autoconf output */
#define	    AC_PAGE	0x10	    /* -p page autoconf output */