Subject: Re: auich_halt_pipe: halt took 100 cycles
To: Rui-Xiang Guo <rxg@myrealbox.com>
From: Jachym Holecek <freza@liberouter.org>
List: current-users
Date: 03/30/2005 15:34:23
> And I have auich device. When it finished playing, it always showed such
> message -
> auich_halt_pipe: halt took 100 cycles

This actually means that auich_halt_pipe() did _not_ succeed for you
(but maybe this is not a problem for auich? I don't know the chip).
The code should probably check completion status and report failure,
like:

Index: auich.c
===================================================================
RCS file: /pub/NetBSD-CVS/src/sys/dev/pci/auich.c,v
retrieving revision 1.90
diff -u -r1.90 auich.c
--- auich.c	11 Mar 2005 22:29:16 -0000	1.90
+++ auich.c	30 Mar 2005 13:26:27 -0000
@@ -878,8 +878,10 @@
 	bus_space_write_1(sc->iot, sc->aud_ioh, pipe + ICH_CTRL, 0);
 	for (i = 0; i < 100; i++) {
 		status = bus_space_read_4(sc->iot, sc->aud_ioh, pipe + ICH_STS);
-		if (status & ICH_DCH)
+		if (status & ICH_DCH) {
+			i = 0;
 			break;
+		}
 		DELAY(1);
 	}
 	bus_space_write_1(sc->iot, sc->aud_ioh, pipe + ICH_CTRL, ICH_RR);
===================================================================

Except that this is ugly -- but you get the idea. The delay could
probably be increased, too...

> Then I take a look into auich.c -
> [...]
> #if 1
>         if (i > 0)
>                 printf("auich_halt_pipe: halt took %d cycles\n", i);
> #endif
> [...]
> 
> Is this debug message necessary? The condiction is always true.

It's not always true. But as I said above, the message should only
be printed on failure, if at all interesting...

	Regards,
		-- Jachym Holecek