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

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

diff -u --recursive --new-file v2.3.40/linux/drivers/scsi/cyberstormII.c linux/drivers/scsi/cyberstormII.c
@@ -15,6 +15,7 @@
 
 #include <linux/module.h>
 
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/types.h>
@@ -59,29 +60,32 @@
 int __init cyberII_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;
 	struct ESP_regs *eregs;
 
-	if((key = zorro_find(ZORRO_PROD_PHASE5_CYBERSTORM_MK_II, 0, 0))){
-		esp_dev = zorro_get_board(key);
-
+	if ((z = zorro_find_device(ZORRO_PROD_PHASE5_CYBERSTORM_MK_II, z))) {
+	    unsigned long board = z->resource.start;
+	    if (request_mem_region(board+CYBERII_ESP_ADDR,
+				   sizeof(struct ESP_regs), "NCR53C9x")) {
 		/* Do some magic to figure out if the CyberStorm Mk II
 		 * is equipped with a SCSI controller
 		 */
-		address = (unsigned long)ZTWO_VADDR(esp_dev->cd_BoardAddr);
+		address = (unsigned long)ZTWO_VADDR(board);
 		eregs = (struct ESP_regs *)(address + CYBERII_ESP_ADDR);
 
-		esp = esp_allocate(tpnt, (void *) esp_dev);
+		esp = esp_allocate(tpnt, (void *)board+CYBERII_ESP_ADDR);
 
 		esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7));
 		udelay(5);
 		if(esp_read(eregs->esp_cfg1) != (ESP_CONFIG1_PENABLE | 7)) {
 			esp_deallocate(esp);
 			scsi_unregister(esp->ehost);
+			release_mem_region(board+CYBERII_ESP_ADDR,
+					   sizeof(struct ESP_regs));
 			return 0; /* Bail out if address did not hold data */
 		}
+		strcpy(z->name, "CyberStorm Mk II SCSI Host Adapter");
 
 		/* Do command transfer with programmed I/O */
 		esp->do_pio_cmds = 1;
@@ -126,7 +130,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 Mk II", esp_intr);
 
@@ -138,11 +141,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;
 }
@@ -264,12 +266,11 @@
 int cyberII_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)