patch-2.3.41 linux/drivers/scsi/gvp11.c

Next file: linux/drivers/scsi/hosts.c
Previous file: linux/drivers/scsi/gdth_proc.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.40/linux/drivers/scsi/gvp11.c linux/drivers/scsi/gvp11.c
@@ -75,7 +75,8 @@
 
 	if ( scsi_alloc_out_of_range || !HDATA(cmd->host)->dma_bounce_buffer) {
 	    HDATA(cmd->host)->dma_bounce_buffer =
-		amiga_chip_alloc(HDATA(cmd->host)->dma_bounce_len);
+		amiga_chip_alloc(HDATA(cmd->host)->dma_bounce_len,
+				       "GVP II SCSI Bounce Buffer");
 
 	    if(!HDATA(cmd->host)->dma_bounce_buffer)
 	    {
@@ -100,7 +101,8 @@
             }
 		
 	    HDATA(cmd->host)->dma_bounce_buffer =
-		amiga_chip_alloc(HDATA(cmd->host)->dma_bounce_len);
+		amiga_chip_alloc(HDATA(cmd->host)->dma_bounce_len,
+				       "GVP II SCSI Bounce Buffer");
 
 	    if(!HDATA(cmd->host)->dma_bounce_buffer)
 	    {
@@ -180,10 +182,9 @@
 {
     static unsigned char called = 0;
     struct Scsi_Host *instance;
-    caddr_t address;
+    unsigned long address;
     unsigned int epc;
-    unsigned int key = 0, skey;
-    const struct ConfigDev *cd;
+    struct zorro_dev *z = NULL;
     unsigned int default_dma_xfer_mask;
 #ifdef CHECK_WD33C93
     volatile unsigned char *sasr_3393, *scmd_3393;
@@ -198,38 +199,39 @@
     tpnt->proc_name = "GVP11";
     tpnt->proc_info = &wd33c93_proc_info;
 
-    while (1) {
+    while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
 	/* 
 	 * This should (hopefully) be the correct way to identify
 	 * all the different GVP SCSI controllers (except for the
 	 * SERIES I though).
 	 */
-	skey = key;
 
-	if ((key = zorro_find(ZORRO_PROD_GVP_COMBO_030_R3_SCSI, 0, skey)) ||
-	    (key = zorro_find(ZORRO_PROD_GVP_SERIES_II, 0, skey)))
+	if (z->id == ZORRO_PROD_GVP_COMBO_030_R3_SCSI ||
+	    z->id == ZORRO_PROD_GVP_SERIES_II)
 	    default_dma_xfer_mask = ~0x00ffffff;
-	else if ((key = zorro_find(ZORRO_PROD_GVP_GFORCE_030_SCSI, 0, skey)) ||
-		 (key = zorro_find(ZORRO_PROD_GVP_A530_SCSI, 0, skey)) ||
-		 (key = zorro_find(ZORRO_PROD_GVP_COMBO_030_R4_SCSI, 0, skey)))
+	else if (z->id == ZORRO_PROD_GVP_GFORCE_030_SCSI ||
+		 z->id == ZORRO_PROD_GVP_A530_SCSI ||
+		 z->id == ZORRO_PROD_GVP_COMBO_030_R4_SCSI)
 	    default_dma_xfer_mask = ~0x01ffffff;
-	else if ((key = zorro_find(ZORRO_PROD_GVP_A1291, 0, skey)) ||
-		 (key = zorro_find(ZORRO_PROD_GVP_GFORCE_040_SCSI_1, 0, skey)))
+	else if (z->id == ZORRO_PROD_GVP_A1291 ||
+		 z->id == ZORRO_PROD_GVP_GFORCE_040_SCSI_1)
 	    default_dma_xfer_mask = ~0x07ffffff;
 	else
-	    break;
-
-	cd = zorro_get_board(key);
-	address = cd->cd_BoardAddr;
+	    continue;
 
 	/*
 	 * Rumors state that some GVP ram boards use the same product
 	 * code as the SCSI controllers. Therefore if the board-size
 	 * is not 64KB we asume it is a ram board and bail out.
 	 */
-	if (cd->cd_BoardSize != 0x10000)
+	if (z->resource.end-z->resource.start != 0xffff)
 		continue;
 
+	address = z->resource.start;
+	if (!request_mem_region(address, 256, "wd33c93"))
+	    continue;
+	strcpy(z->name, "GVP Series II SCSI");
+
 #ifdef CHECK_WD33C93
 
 	/*
@@ -251,18 +253,18 @@
 
 	q = *sasr_3393;		/* read it */
 	if (q & 0x08)		/* bit 3 should always be clear */
-		continue;
+		goto release;
 	*sasr_3393 = WD_AUXILIARY_STATUS;	 /* setup indirect address */
 	if (*sasr_3393 == WD_AUXILIARY_STATUS) { /* shouldn't retain the write */
 		*sasr_3393 = save_sasr;	/* Oops - restore this byte */
-		continue;
+		goto release;
 		}
 	if (*sasr_3393 != q) {	/* should still read the same */
 		*sasr_3393 = save_sasr;	/* Oops - restore this byte */
-		continue;
+		goto release;
 		}
 	if (*scmd_3393 != q)	/* and so should the image at 0x1f */
-		continue;
+		goto release;
 
 
     /* Ok, we probably have a wd33c93, but let's check a few other places
@@ -279,7 +281,7 @@
 	*sasr_3393 = WD_SCSI_STATUS;
 	*scmd_3393 = q;
 	if (qq != q)			/* should be read only */
-		continue;
+		goto release;
 	*sasr_3393 = 0x1e;	/* this register is unimplemented */
 	q = *scmd_3393;
 	*sasr_3393 = 0x1e;
@@ -289,7 +291,7 @@
 	*sasr_3393 = 0x1e;
 	*scmd_3393 = q;
 	if (qq != q || qq != 0xff)	/* should be read only, all 1's */
-		continue;
+		goto release;
 	*sasr_3393 = WD_TIMEOUT_PERIOD;
 	q = *scmd_3393;
 	*sasr_3393 = WD_TIMEOUT_PERIOD;
@@ -299,13 +301,13 @@
 	*sasr_3393 = WD_TIMEOUT_PERIOD;
 	*scmd_3393 = q;
 	if (qq != (~q & 0xff))		/* should be read/write */
-		continue;
+		goto release;
 #endif
 
 	instance = scsi_register (tpnt, sizeof (struct WD33C93_hostdata));
-	instance->base = (unsigned char *)ZTWO_VADDR(address);
+	instance->base = ZTWO_VADDR(address);
 	instance->irq = IRQ_AMIGA_PORTS;
-	instance->unique_id = key;
+	instance->unique_id = z->slotaddr;
 
 	if (gvp11_xfer_mask)
 		HDATA(instance)->dma_xfer_mask = gvp11_xfer_mask;
@@ -340,7 +342,10 @@
 			    "GVP11 SCSI", gvp11_intr);
 	}
 	DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE;
-	zorro_config_board(key, 0);
+	continue;
+
+release:
+	release_mem_region(ZTWO_PADDR(instance->base), 256);
     }
 
     return num_gvp11;
@@ -363,7 +368,7 @@
 {
 #ifdef MODULE
     DMA(instance)->CNTR = 0;
-    zorro_unconfig_board(instance->unique_id, 0);
+    release_mem_region(ZTWO_PADDR(instance->base), 256);
     if (--num_gvp11 == 0)
 	    free_irq(IRQ_AMIGA_PORTS, gvp11_intr);
     wd33c93_release();

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