X-Authentication-Warning: ulab-17.ms.mff.cuni.cz: prak3264 owned process doing -bs
Date: Wed, 19 Nov 1997 15:20:34 +0100 (MET)
From: Patrik Rak <prak3264@ss1000.ms.mff.cuni.cz>
X-Sender: prak3264@ulab-17.ms.mff.cuni.cz
To: linux-m68k@lists.linux-m68k.org
Subject: L68K: Fastlane & ESP patches.
Sender: owner-linux-m68k@phil.uni-sb.de

Hi!

I have found misplaced ifdef in drivers/scsi/esp.c, which was responsible
for causing havoc under certain situations (reset completed while there
was deselected command).

Below are two patches fixing this, one for 2.0.31-pre3 and second one for
2.1.64.

Also, the 2.1.64 patch contains the "forgotten enable_irq() in
esp_abort()" patch I already sent here relative to 2.1.61.

I also fixed some interrupt handling the fastlane(_eps).c to really do
what esp.c expects it should do... The patches below contain these fixes
as well.

I have tested the 2.0.31-pre3 patch. The 6.1.64 one was not tested yet
(the kernel will build tonight:), but I have tested the same patch on
2.1.61 and it worked fine (well, it at least did not broke anything :).

Note that I am not sure (yet) if this patches cure the annoying
fastlane-lockup bug...

Patrik

--- linux-2.0.31-pre3/drivers/scsi/fastlane_esp.c	1997/11/18 20:09:13	1.1
+++ linux-2.0.31-pre3/drivers/scsi/fastlane_esp.c	1997/11/19 13:43:16
@@ -5,8 +5,8 @@
  * This driver is based on the CyberStorm driver, hence the occasional
  * reference to CyberStorm.
  *
- * Betatesting and crucial adjustments by Patrik Rak ()
- *
+ * Betatesting and crucial adjustments by
+ *     Patrik Rak (prak3264@ss1000.ms.mff.cuni.cz)
  */
 
 /* TODO:
@@ -272,18 +272,12 @@
 
 static void dma_ints_off(struct Sparc_ESP *esp)
 {
-	custom.intena = (IF_PORTS);
-/*
 	disable_irq(esp->irq);
-*/
 }
 
 static void dma_ints_on(struct Sparc_ESP *esp)
 {
-	custom.intena = (IF_SETCLR | IF_PORTS);
-/*
 	enable_irq(esp->irq);
-*/
 }
 
 static void dma_irq_exit(struct Sparc_ESP *esp)
@@ -292,7 +286,9 @@
 		(struct fastlane_dma_registers *) esp->dregs;
 
 	dregs->ctrl_reg = (ctrl_data & ~(FASTLANE_DMA_ESI|FASTLANE_DMA_EDI) );
+	nop();
 	dregs->ctrl_reg = ctrl_data;
+	nop();
 }
 
 static int dma_irq_p(struct Sparc_ESP *esp)
@@ -306,22 +302,10 @@
 	if(dma_status & FASTLANE_DMA_IACT)
 		return 0;	/* not our IRQ */
 
-	/* We should perhaps call dma_clear() here, but certainly not always.
-	 * However, I would need more info from fastlane driver to do that
-	 * properly. Thus, I omit this completely so far. -Patrik
-	 */
-
-	/* Return 1 if ESP requested IRQ */
-	if((dma_status & FASTLANE_DMA_CREQ) &&
+	/* Return non-zero if ESP requested IRQ */
+	return ((dma_status & FASTLANE_DMA_CREQ) &&
 	   (!(dma_status & FASTLANE_DMA_MINT)) &&
-	   ((((struct ESP_regs *) esp->eregs)->esp_status) & ESP_STAT_INTR))
-		/* the flags will get strobed in dma_irq_exit later */	
-		return 1;
-	
-	dregs->ctrl_reg = (ctrl_data & ~(FASTLANE_DMA_EDI|FASTLANE_DMA_ESI) );
-	dregs->ctrl_reg = ctrl_data;
-
-	return 0;
+	   ((((struct ESP_regs *) esp->eregs)->esp_status) & ESP_STAT_INTR));
 }
 
 static void dma_led_off(struct Sparc_ESP *esp)
--- linux-2.0.31-pre3/drivers/scsi/esp.c	1997/11/18 20:09:13	1.1
+++ linux-2.0.31-pre3/drivers/scsi/esp.c	1997/11/19 12:04:12
@@ -3123,8 +3123,8 @@
 		if(esp->disconnected_SC) {
 			Scsi_Cmnd *SCptr;
 			while((SCptr = remove_first_SC(&esp->disconnected_SC))) {
-				if(!SCptr->use_sg)
 #ifdef CONFIG_SCSI_SUNESP
+				if(!SCptr->use_sg)
 					mmu_release_scsi_one((char *)
 							     SCptr->SCp.have_data_in,
 							     SCptr->request_bufflen,


