int fastlane_esp_release(struct Scsi_Host *instance) { #ifdef MODULE unsigned long address = (unsigned long)((struct NCR_ESP *)instance->hostdata)->edev; esp_deallocate((struct NCR_ESP *)instance->hostdata); esp_release(); release_mem_region(address, sizeof(struct ESP_regs)); free_irq(IRQ_AMIGA_PORTS, esp_intr); #endif return 1; }
/***************************************************************** Detection */ int __init cyberII_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; struct zorro_dev *z = NULL; unsigned long address; struct ESP_regs *eregs; 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(board); eregs = (struct ESP_regs *)(address + CYBERII_ESP_ADDR); 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 */ } /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = 0; esp->dma_drain = 0; esp->dma_invalidate = 0; esp->dma_irq_entry = 0; esp->dma_irq_exit = 0; esp->dma_led_on = &dma_led_on; esp->dma_led_off = &dma_led_off; esp->dma_poll = 0; esp->dma_reset = 0; /* SCSI chip speed */ esp->cfreq = 40000000; /* The DMA registers on the CyberStorm are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ esp->dregs = (void *)(address + CYBERII_DMA_ADDR); /* ESP register base */ esp->eregs = eregs; /* Set the command buffer */ esp->esp_command = cmd_buffer; esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, "CyberStorm SCSI Mk II", esp_intr); /* Figure out our scsi ID on the bus */ esp->scsi_id = 7; /* We don't have a differential SCSI-bus. */ esp->diff = 0; esp_initialize(esp); 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; }
/***************************************************************** Detection */ int __init blz1230_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; struct zorro_dev *z = NULL; unsigned long address; struct ESP_regs *eregs; unsigned long board; #if MKIV #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 #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 if ((z = zorro_find_device(REAL_BLZ1230_ID, z))) { 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 = 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)) goto err_out; /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = 0; esp->dma_drain = 0; esp->dma_invalidate = 0; esp->dma_irq_entry = 0; esp->dma_irq_exit = 0; esp->dma_led_on = 0; esp->dma_led_off = 0; esp->dma_poll = 0; esp->dma_reset = 0; /* SCSI chip speed */ esp->cfreq = 40000000; /* The DMA registers on the Blizzard are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ esp->dregs = (void *)(address + REAL_BLZ1230_DMA_ADDR); /* ESP register base */ esp->eregs = eregs; /* Set the command buffer */ esp->esp_command = cmd_buffer; esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; esp->slot = board+REAL_BLZ1230_ESP_ADDR; if (request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, "Blizzard 1230 SCSI IV", esp->ehost)) goto err_out; /* Figure out our scsi ID on the bus */ esp->scsi_id = 7; /* We don't have a differential SCSI-bus. */ esp->diff = 0; esp_initialize(esp); 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; err_out: scsi_unregister(esp->ehost); esp_deallocate(esp); release_mem_region(board+REAL_BLZ1230_ESP_ADDR, sizeof(struct ESP_regs)); return 0; }
/* Detecting ESP chips on the machine. This is the simple and easy * version. */ int sun3x_esp_detect(struct scsi_host_template *tpnt) { struct NCR_ESP *esp; struct ConfigDev *esp_dev; esp_dev = 0; esp = esp_allocate(tpnt, (void *) esp_dev); /* Do command transfer with DMA */ esp->do_pio_cmds = 0; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = &dma_barrier; esp->dma_invalidate = &dma_invalidate; esp->dma_drain = &dma_drain; esp->dma_irq_entry = 0; esp->dma_irq_exit = 0; esp->dma_led_on = 0; esp->dma_led_off = 0; esp->dma_poll = &dma_poll; esp->dma_reset = &dma_reset; /* virtual DMA functions */ esp->dma_mmu_get_scsi_one = &dma_mmu_get_scsi_one; esp->dma_mmu_get_scsi_sgl = &dma_mmu_get_scsi_sgl; esp->dma_mmu_release_scsi_one = &dma_mmu_release_scsi_one; esp->dma_mmu_release_scsi_sgl = &dma_mmu_release_scsi_sgl; esp->dma_advance_sg = &dma_advance_sg; /* SCSI chip speed */ esp->cfreq = 20000000; esp->eregs = (struct ESP_regs *)(SUN3X_ESP_BASE); esp->dregs = (void *)SUN3X_ESP_DMA; esp->esp_command = (volatile unsigned char *)dvma_malloc(DVMA_PAGE_SIZE); esp->esp_command_dvma = dvma_vtob((unsigned long)esp->esp_command); esp->irq = 2; if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, "SUN3X SCSI", esp->ehost)) { esp_deallocate(esp); return 0; } esp->scsi_id = 7; esp->diff = 0; esp_initialize(esp); /* for reasons beyond my knowledge (and which should likely be fixed) sync mode doesn't work on a 3/80 at 5mhz. but it does at 4. */ esp->sync_defp = 0x3f; 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; }