diff options
Diffstat (limited to 'drivers/scsi/blz1230.c')
-rw-r--r-- | drivers/scsi/blz1230.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/drivers/scsi/blz1230.c b/drivers/scsi/blz1230.c index 143bdf9eb..bd437e7e1 100644 --- a/drivers/scsi/blz1230.c +++ b/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 @@ volatile unsigned char cmd_buffer[16]; 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 @@ int __init blz1230_esp_detect(Scsi_Host_Template *tpnt) * 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 @@ int __init blz1230_esp_detect(Scsi_Host_Template *tpnt) 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 @@ int __init blz1230_esp_detect(Scsi_Host_Template *tpnt) 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 @@ Scsi_Host_Template driver_template = SCSI_BLZ1230; 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; |