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

Next file: linux/drivers/scsi/cyberstormII.c
Previous file: linux/drivers/scsi/blz2060.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.40/linux/drivers/scsi/cyberstorm.c linux/drivers/scsi/cyberstorm.c
@@ -19,6 +19,7 @@
 
 #include <linux/module.h>
 
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/types.h>
@@ -69,24 +70,28 @@
 int __init cyber_esp_detect(Scsi_Host_Template *tpnt)
 {
 	struct NCR_ESP *esp;
-	const struct ConfigDev *esp_dev;
-	unsigned int key;
+	struct zorro_dev *z = NULL;
 	unsigned long address;
 
-
-	if ((key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_1220_CYBERSTORM, 0, 0)) ||
-	    (key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060, 0, 0))){
-		esp_dev = zorro_get_board(key);
-
+	while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
+	    unsigned long board = z->resource.start;
+	    if ((z->id == ZORRO_PROD_PHASE5_BLIZZARD_1220_CYBERSTORM ||
+		 z->id == ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060) &&
+		request_mem_region(board+CYBER_ESP_ADDR,
+		    		   sizeof(struct ESP_regs), "NCR53C9x")) {
 		/* Figure out if this is a CyberStorm or really a 
 		 * Fastlane/Blizzard Mk II by looking at the board size.
 		 * CyberStorm maps 64kB
 		 * (ZORRO_PROD_PHASE5_BLIZZARD_1220_CYBERSTORM does anyway)
 		 */
-		if((unsigned long)esp_dev->cd_BoardSize != 0x10000)
+		if(z->resource.end-board != 0xffff) {
+			release_mem_region(board+CYBER_ESP_ADDR,
+					   sizeof(struct ESP_regs));
 			return 0;
+		}
+		strcpy(z->name, "Cyberstorm SCSI Host Adapter");
 
-		esp = esp_allocate(tpnt, (void *) esp_dev);
+		esp = esp_allocate(tpnt, (void *)board+CYBER_ESP_ADDR);
 
 		/* Do command transfer with programmed I/O */
 		esp->do_pio_cmds = 1;
@@ -121,7 +126,7 @@
 		 * relative to the device (i.e. in the same Zorro
 		 * I/O block).
 		 */
-		address = (unsigned long)ZTWO_VADDR(esp_dev->cd_BoardAddr);
+		address = (unsigned long)ZTWO_VADDR(board);
 		esp->dregs = (void *)(address + CYBER_DMA_ADDR);
 
 		/* ESP register base */
@@ -132,7 +137,6 @@
 		esp->esp_command_dvma = virt_to_bus(cmd_buffer);
 
 		esp->irq = IRQ_AMIGA_PORTS;
-		esp->slot = key;
 		request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ,
 			    "CyberStorm SCSI", esp_intr);
 		/* Figure out our scsi ID on the bus */
@@ -148,11 +152,10 @@
 
 		esp_initialize(esp);
 
-		zorro_config_board(key, 0);
-
 		printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps, esps_in_use);
 		esps_running = esps_in_use;
 		return esps_in_use;
+	    }
 	}
 	return 0;
 }
@@ -314,12 +317,11 @@
 int cyber_esp_release(struct Scsi_Host *instance)
 {
 #ifdef MODULE
-	unsigned int key;
+	unsigned long address = (unsigned long)((struct NCR_ESP *)instance->hostdata)->edev;
 
-	key = ((struct NCR_ESP *)instance->hostdata)->slot;
 	esp_deallocate((struct NCR_ESP *)instance->hostdata);
 	esp_release();
-	zorro_unconfig_board(key, 0);
+	release_mem_region(address, sizeof(struct ESP_regs));
 	free_irq(IRQ_AMIGA_PORTS, esp_intr);
 #endif
 	return 1;

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