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

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

diff -u --recursive --new-file v2.3.40/linux/drivers/scsi/blz1230.c linux/drivers/scsi/blz1230.c
@@ -16,6 +16,7 @@
 
 #include <linux/module.h>
 
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/types.h>
@@ -60,37 +61,41 @@
 int __init blz1230_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 MKIV
-	if ((key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_1230_IV_1260, 0, 0))){
+#define REAL_BLZ1230_ID		ZORRO_PROD_PHASE5_BLIZZARD_1230_IV_1260
+#define REAL_BLZ1230_ESP_ADDR	BLZ1230_ESP_ADDR
+#define REAL_BLZ1230_DMA_ADDR	BLZ1230_DMA_ADDR
 #else
-	if ((key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060, 0, 0))){
+#define REAL_BLZ1230_ID		ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060
+#define REAL_BLZ1230_ESP_ADDR	BLZ1230II_ESP_ADDR
+#define REAL_BLZ1230_DMA_ADDR	BLZ1230II_DMA_ADDR
 #endif
-		esp_dev = zorro_get_board(key);
 
+	if ((z = zorro_find_device(REAL_BLZ1230_ID, z))) {
+	    unsigned long board = z->resource.start;
+	    if (request_mem_region(board+REAL_BLZ1230_ESP_ADDR,
+				   sizeof(struct ESP_regs), "NCR53C9x")) {
 		/* Do some magic to figure out if the blizzard is
 		 * equipped with a SCSI controller
 		 */
-		address = (unsigned long)ZTWO_VADDR(esp_dev->cd_BoardAddr);
-#if MKIV
-		eregs = (struct ESP_regs *)(address + BLZ1230_ESP_ADDR);
-#else
-		eregs = (struct ESP_regs *)(address + BLZ1230II_ESP_ADDR);
-#endif
-
-		esp = esp_allocate(tpnt, (void *) esp_dev);
+		address = ZTWO_VADDR(board);
+		eregs = (struct ESP_regs *)(address + REAL_BLZ1230_ESP_ADDR);
+		esp = esp_allocate(tpnt, (void *)board+REAL_BLZ1230_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+REAL_BLZ1230_ESP_ADDR,
+					   sizeof(struct ESP_regs));
 			return 0; /* Bail out if address did not hold data */
 		}
+		strcpy(z->name, "Blizzard 1230 SCSI IV");
 
 		/* Do command transfer with programmed I/O */
 		esp->do_pio_cmds = 1;
@@ -125,11 +130,7 @@
 		 * relative to the device (i.e. in the same Zorro
 		 * I/O block).
 		 */
-#if MKIV
-		esp->dregs = (void *)(address + BLZ1230_DMA_ADDR);
-#else
-		esp->dregs = (void *)(address + BLZ1230II_DMA_ADDR);
-#endif	
+		esp->dregs = (void *)(address + REAL_BLZ1230_DMA_ADDR);
 	
 		/* ESP register base */
 		esp->eregs = eregs;
@@ -139,7 +140,7 @@
 		esp->esp_command_dvma = virt_to_bus(cmd_buffer);
 
 		esp->irq = IRQ_AMIGA_PORTS;
-		esp->slot = key;
+		esp->slot = board+REAL_BLZ1230_ESP_ADDR;
 		request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ,
 			    "Blizzard 1230 SCSI IV", esp_intr);
 
@@ -151,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;
 }
@@ -289,12 +289,10 @@
 int blz1230_esp_release(struct Scsi_Host *instance)
 {
 #ifdef MODULE
-	unsigned int key;
-
-	key = ((struct NCR_ESP *)instance->hostdata)->slot;
+	unsigned long address = (unsigned long)((struct NCR_ESP *)instance->hostdata)->edev;
 	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)