Subject: Re: ata/wdc vs gcc3 on amiga
To: Jukka Andberg <jandberg@netbsd.org>
From: Martin Husemann <martin@duskware.de>
List: tech-kern
Date: 04/14/2004 13:13:38
As Jukka already confirmed, changing chp_flags to volatile seems to
help similar lossage I experienced on shark.

Any objections to commiting the attached patch?

Martin

Index: ic/wdcvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/wdcvar.h,v
retrieving revision 1.55
diff -c -u -r1.55 wdcvar.h
--- ic/wdcvar.h	3 Jan 2004 23:59:58 -0000	1.55
+++ ic/wdcvar.h	14 Apr 2004 10:32:45 -0000
@@ -70,7 +70,7 @@
 	bus_space_handle_t      data32ioh;
 
 	/* Our state */
-	int ch_flags;
+	volatile int ch_flags;
 #define WDCF_ACTIVE   0x01	/* channel is active */
 #define WDCF_SHUTDOWN 0x02	/* channel is shutting down */
 #define WDCF_IRQ_WAIT 0x10	/* controller is waiting for irq */
Index: ata/ata.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ata/ata.c,v
retrieving revision 1.27
diff -c -u -r1.27 ata.c
--- ata/ata.c	3 Jan 2004 23:59:58 -0000	1.27
+++ ata/ata.c	14 Apr 2004 10:32:45 -0000
@@ -165,7 +165,7 @@
 		splx(s);
 	}
 	chp->ch_thread = NULL;
-	wakeup(&chp->ch_flags);
+	wakeup((void*)&chp->ch_flags);
 	kthread_exit(0);
 }
 
@@ -307,7 +307,7 @@
 	chp->ch_flags |= WDCF_SHUTDOWN;
 	wakeup(&chp->ch_thread);
 	while (chp->ch_thread != NULL)
-		(void) tsleep(&chp->ch_flags, PRIBIO, "atadown", 0);
+		(void) tsleep((void*)&chp->ch_flags, PRIBIO, "atadown", 0);
 	
 	/*
 	 * Detach atapibus and its children.