patch-2.3.48 linux/drivers/scsi/sgiwd93.c

Next file: linux/drivers/scsi/sgiwd93.h
Previous file: linux/drivers/scsi/qlogicfc.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.47/linux/drivers/scsi/sgiwd93.c linux/drivers/scsi/sgiwd93.c
@@ -2,10 +2,12 @@
  * sgiwd93.c: SGI WD93 scsi driver.
  *
  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
- *
+ *		 1999 Andrew R. Baker (andrewb@uab.edu)
+ *		      - Support for 2nd SCSI controller on Indigo2
+ * 
  * (In all truth, Jed Schimmel wrote all this code.)
  *
- * $Id: sgiwd93.c,v 1.13 1999/03/28 23:06:06 tsbogend Exp $
+ * $Id: sgiwd93.c,v 1.20 2000/02/21 15:05:48 ralf Exp $
  */
 #include <linux/init.h>
 #include <linux/types.h>
@@ -13,16 +15,16 @@
 #include <linux/blk.h>
 #include <linux/version.h>
 #include <linux/delay.h>
+#include <linux/spinlock.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
-#include <asm/sgi.h>
 #include <asm/sgialib.h>
-#include <asm/sgimc.h>
-#include <asm/sgihpc.h>
-#include <asm/sgint23.h>
+#include <asm/sgi/sgi.h>
+#include <asm/sgi/sgimc.h>
+#include <asm/sgi/sgihpc.h>
+#include <asm/sgi/sgint23.h>
 #include <asm/irq.h>
-#include <asm/spinlock.h>
 #include <asm/io.h>
 
 #include "scsi.h"
@@ -38,6 +40,7 @@
 };
 
 struct Scsi_Host *sgiwd93_host = NULL;
+struct Scsi_Host *sgiwd93_host1 = NULL;
 
 /* Wuff wuff, wuff, wd33c93.c, wuff wuff, object oriented, bow wow. */
 static inline void write_wd33c93_count(wd33c93_regs *regp, unsigned long value)
@@ -65,7 +68,7 @@
 	unsigned long flags;
 
 	spin_lock_irqsave(&io_request_lock, flags);
-	wd33c93_intr(sgiwd93_host);
+	wd33c93_intr((struct Scsi_Host *) dev_id);
 	spin_unlock_irqrestore(&io_request_lock, flags);
 }
 
@@ -231,9 +234,9 @@
 #endif
 }
 
-void sgiwd93_reset(void)
+void sgiwd93_reset(uchar *base)
 {
-	struct hpc3_scsiregs *hregs = &hpc3c0->scsi_chan0;
+	struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) base;
 
 	hregs->ctrl = HPC3_SCTRL_CRESET;
 	udelay (50);
@@ -261,9 +264,11 @@
 {
 	static unsigned char called = 0;
 	struct hpc3_scsiregs *hregs = &hpc3c0->scsi_chan0;
+	struct hpc3_scsiregs *hregs1 = &hpc3c0->scsi_chan1;
 	struct WD33C93_hostdata *hdata;
+	struct WD33C93_hostdata *hdata1;
 	uchar *buf;
-
+	
 	if(called)
 		return 0; /* Should bitch on the console about this... */
 
@@ -271,12 +276,12 @@
 
 	sgiwd93_host = scsi_register(SGIblows, sizeof(struct WD33C93_hostdata));
 	sgiwd93_host->base = (unsigned char *) hregs;
-	sgiwd93_host->irq = 1;
+	sgiwd93_host->irq = SGI_WD93_0_IRQ;
 
 	buf = (uchar *) get_free_page(GFP_KERNEL);
 	init_hpc_chain(buf);
 	dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
-
+	/* HPC_SCSI_REG0 | 0x03 | KSEG1 */
 	wd33c93_init(sgiwd93_host, (wd33c93_regs *) 0xbfbc0003,
 		     dma_setup, dma_stop, WD33C93_FS_16_20);
 
@@ -285,7 +290,28 @@
 	hdata->dma_bounce_buffer = (uchar *) (KSEG1ADDR(buf));
 	dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
 
-	request_irq(1, sgiwd93_intr, 0, "SGI WD93", (void *) sgiwd93_host);
+	request_irq(SGI_WD93_0_IRQ, sgiwd93_intr, 0, "SGI WD93", (void *) sgiwd93_host);
+        /* set up second controller on the Indigo2 */
+	if(!sgi_guiness) {
+		sgiwd93_host1 = scsi_register(SGIblows, sizeof(struct WD33C93_hostdata));
+		sgiwd93_host1->base = (unsigned char *) hregs1;
+		sgiwd93_host1->irq = SGI_WD93_1_IRQ;
+
+		buf = (uchar *) get_free_page(GFP_KERNEL);
+		init_hpc_chain(buf);
+		dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
+		/* HPC_SCSI_REG1 | 0x03 | KSEG1 */
+		wd33c93_init(sgiwd93_host1, (wd33c93_regs *) 0xbfbc8003,
+			     dma_setup, dma_stop, WD33C93_FS_16_20);
+
+		hdata1 = (struct WD33C93_hostdata *)sgiwd93_host1->hostdata;
+		hdata1->no_sync = 0;
+		hdata1->dma_bounce_buffer = (uchar *) (KSEG1ADDR(buf));
+		dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
+
+		request_irq(SGI_WD93_1_IRQ, sgiwd93_intr, 0, "SGI WD93", (void *) sgiwd93_host1);
+	}
+	
 	called = 1;
 
 	return 1; /* Found one. */
@@ -306,9 +332,14 @@
 int sgiwd93_release(struct Scsi_Host *instance)
 {
 #ifdef MODULE
-	free_irq(1, sgiwd93_intr);
+	free_irq(SGI_WD93_0_IRQ, sgiwd93_intr);
 	free_page(KSEG0ADDR(hdata->dma_bounce_buffer));
 	wd33c93_release();
+	if(!sgi_guiness) {
+		free_irq(SGI_WD93_1_IRQ, sgiwd93_intr);
+		free_page(KSEG0ADDR(hdata1->dma_bounce_buffer));
+		wd33c93_release();
+	}
 #endif
 	return 1;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)