int ecoscsi_detect(Scsi_Host_Template * tpnt) { struct Scsi_Host *instance; tpnt->proc_name = "ecoscsi"; instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); instance->io_port = 0x80ce8000; instance->n_io_port = 144; instance->irq = IRQ_NONE; if (check_region (instance->io_port, instance->n_io_port)) { scsi_unregister (instance); return 0; } ecoscsi_write (instance, MODE_REG, 0x20); /* Is it really SCSI? */ if (ecoscsi_read (instance, MODE_REG) != 0x20) { /* Write to a reg. */ scsi_unregister(instance); return 0; /* and try to read */ } ecoscsi_write( instance, MODE_REG, 0x00 ); /* it back. */ if (ecoscsi_read (instance, MODE_REG) != 0x00) { scsi_unregister(instance); return 0; } NCR5380_init(instance, 0); if (request_region (instance->io_port, instance->n_io_port, "ecoscsi") == NULL) { scsi_unregister(instance); return 0; } if (instance->irq != IRQ_NONE) if (request_irq(instance->irq, do_ecoscsi_intr, SA_INTERRUPT, "ecoscsi", NULL)) { printk("scsi%d: IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = IRQ_NONE; } if (instance->irq != IRQ_NONE) { printk("scsi%d: eek! Interrupts enabled, but I don't think\n", instance->host_no); printk("scsi%d: that the board had an interrupt!\n", instance->host_no); } printk("scsi%d: at port %X irq", instance->host_no, instance->io_port); if (instance->irq == IRQ_NONE) printk ("s disabled"); else printk (" %d", instance->irq); printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", CAN_QUEUE, CMD_PER_LUN, ECOSCSI_PUBLIC_RELEASE); printk("\nscsi%d:", instance->host_no); NCR5380_print_options(instance); printk("\n"); return 1; }
static int mac_esp_release(struct Scsi_Host *shost) { if (shost->irq) free_irq(shost->irq, NULL); if (shost->io_port && shost->n_io_port) release_region(shost->io_port, shost->n_io_port); scsi_unregister(shost); return 0; }
static void fdomain_release(struct pcmcia_device *link) { scsi_info_t *info = link->priv; dev_dbg(&link->dev, "fdomain_release\n"); scsi_remove_host(info->host); pcmcia_disable_device(link); scsi_unregister(info->host); }
int mvme147_detect(struct scsi_host_template *tpnt) { static unsigned char called = 0; struct Scsi_Host *instance; wd33c93_regs regs; struct WD33C93_hostdata *hdata; if (!MACH_IS_MVME147 || called) return 0; called++; tpnt->proc_name = "MVME147"; tpnt->proc_info = &wd33c93_proc_info; instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); if (!instance) goto err_out; instance->base = 0xfffe4000; instance->irq = MVME147_IRQ_SCSI_PORT; regs.SASR = (volatile unsigned char *)0xfffe4000; regs.SCMD = (volatile unsigned char *)0xfffe4001; hdata = shost_priv(instance); hdata->no_sync = 0xff; hdata->fast = 0; hdata->dma_mode = CTRL_DMA; wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10); if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0, "MVME147 SCSI PORT", instance)) goto err_unregister; if (request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0, "MVME147 SCSI DMA", instance)) goto err_free_irq; #if 0 /* Disabled; causes problems booting */ m147_pcc->scsi_interrupt = 0x10; /* Assert SCSI bus reset */ udelay(100); m147_pcc->scsi_interrupt = 0x00; /* Negate SCSI bus reset */ udelay(2000); m147_pcc->scsi_interrupt = 0x40; /* Clear bus reset interrupt */ #endif m147_pcc->scsi_interrupt = 0x09; /* Enable interrupt */ m147_pcc->dma_cntrl = 0x00; /* ensure DMA is stopped */ m147_pcc->dma_intr = 0x89; /* Ack and enable ints */ return 1; err_free_irq: free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr); err_unregister: scsi_unregister(instance); err_out: return 0; }
int esas2r_release(struct Scsi_Host *sh) { esas2r_log_dev(ESAS2R_LOG_INFO, &(sh->shost_gendev), "esas2r_release() called"); esas2r_cleanup(sh); if (sh->irq) free_irq(sh->irq, NULL); scsi_unregister(sh); return 0; }
static int __init lasi700_driver_callback(struct parisc_device *dev) { unsigned long base = dev->hpa + LASI_SCSI_CORE_OFFSET; int irq = busdevice_alloc_irq(dev); char *driver_name; struct Scsi_Host *host; struct NCR_700_Host_Parameters *hostdata = kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); if(dev->id.sversion == LASI_700_SVERSION) { driver_name = "lasi700"; } else { driver_name = "lasi710"; } if(hostdata == NULL) { printk(KERN_ERR "%s: Failed to allocate host data\n", driver_name); return 1; } memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); if(request_mem_region(base, 64, driver_name) == NULL) { printk(KERN_ERR "%s: Failed to claim memory region\n", driver_name); kfree(hostdata); return 1; } hostdata->base = base; hostdata->differential = 0; if(dev->id.sversion == LASI_700_SVERSION) { hostdata->clock = LASI700_CLOCK; hostdata->force_le_on_be = 1; } else { hostdata->clock = LASI710_CLOCK; hostdata->force_le_on_be = 0; hostdata->chip710 = 1; hostdata->dmode_extra = DMODE_FC2; } if((host = NCR_700_detect(host_tpnt, hostdata)) == NULL) { kfree(hostdata); release_mem_region(host->base, 64); return 1; } host->irq = irq; if(request_irq(irq, NCR_700_intr, SA_SHIRQ, driver_name, host)) { printk(KERN_ERR "%s: irq problem, detatching\n", driver_name); scsi_unregister(host); NCR_700_release(host); return 1; } host_count++; return 0; }
static int amiga7xx_release(struct Scsi_Host *shost) { if (shost->irq) free_irq(shost->irq, NULL); if (shost->dma_channel != 0xff) free_dma(shost->dma_channel); if (shost->io_port && shost->n_io_port) release_region(shost->io_port, shost->n_io_port); scsi_unregister(shost); return 0; }
static int __init a2091_detect(struct scsi_host_template *tpnt) { static unsigned char called = 0; struct Scsi_Host *instance; unsigned long address; struct zorro_dev *z = NULL; wd33c93_regs regs; int num_a2091 = 0; if (!MACH_IS_AMIGA || called) return 0; called = 1; tpnt->proc_name = "A2091"; tpnt->proc_info = &wd33c93_proc_info; while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { if (z->id != ZORRO_PROD_CBM_A590_A2091_1 && z->id != ZORRO_PROD_CBM_A590_A2091_2) continue; address = z->resource.start; if (!request_mem_region(address, 256, "wd33c93")) continue; instance = scsi_register (tpnt, sizeof (struct WD33C93_hostdata)); if (instance == NULL) goto release; instance->base = ZTWO_VADDR(address); instance->irq = IRQ_AMIGA_PORTS; instance->unique_id = z->slotaddr; DMA(instance)->DAWR = DAWR_A2091; regs.SASR = &(DMA(instance)->SASR); regs.SCMD = &(DMA(instance)->SCMD); HDATA(instance)->no_sync = 0xff; HDATA(instance)->fast = 0; HDATA(instance)->dma_mode = CTRL_DMA; wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10); if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, "A2091 SCSI", instance)) goto unregister; DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; num_a2091++; continue; unregister: scsi_unregister(instance); wd33c93_release(); release: release_mem_region(address, 256); } return num_a2091; }
int nbpmacscsi_release (struct Scsi_Host *shpnt) { if (shpnt->irq != SCSI_IRQ_NONE) free_irq (shpnt->irq, shpnt); #ifdef DRQ_INTERRUPT free_irq (drq, shpnt); #endif NCR5380_exit(shpnt); scsi_unregister(shpnt); return 0; }
static void aha152x_release_cs(dev_link_t *link) { scsi_info_t *info = link->priv; scsi_remove_host(info->host); link->dev = NULL; CardServices(ReleaseConfiguration, link->handle); CardServices(ReleaseIO, link->handle, &link->io); CardServices(ReleaseIRQ, link->handle, &link->irq); link->state &= ~DEV_CONFIG; scsi_unregister(info->host); }
static void qlogic_release(dev_link_t *link) { scsi_info_t *info = link->priv; DEBUG(0, "qlogic_release(0x%p)\n", link); scsi_remove_host(info->host); link->dev = NULL; CardServices(ReleaseConfiguration, link->handle); CardServices(ReleaseIO, link->handle, &link->io); CardServices(ReleaseIRQ, link->handle, &link->irq); scsi_unregister(info->host); link->state &= ~DEV_CONFIG; }
static void fdomain_release(dev_link_t *link) { scsi_info_t *info = link->priv; DEBUG(0, "fdomain_release(0x%p)\n", link); scsi_remove_host(info->host); link->dev = NULL; pcmcia_release_configuration(link->handle); pcmcia_release_io(link->handle, &link->io); pcmcia_release_irq(link->handle, &link->irq); scsi_unregister(info->host); link->state &= ~DEV_CONFIG; }
int __init a3000_detect(struct scsi_host_template *tpnt) { wd33c93_regs regs; if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) return 0; if (!request_mem_region(0xDD0000, 256, "wd33c93")) return 0; tpnt->proc_name = "A3000"; tpnt->proc_info = &wd33c93_proc_info; a3000_host = scsi_register (tpnt, sizeof(struct WD33C93_hostdata)); if (a3000_host == NULL) goto fail_register; a3000_host->base = ZTWO_VADDR(0xDD0000); a3000_host->irq = IRQ_AMIGA_PORTS; DMA(a3000_host)->DAWR = DAWR_A3000; regs.SASR = &(DMA(a3000_host)->SASR); regs.SCMD = &(DMA(a3000_host)->SCMD); HDATA(a3000_host)->no_sync = 0xff; HDATA(a3000_host)->fast = 0; HDATA(a3000_host)->dma_mode = CTRL_DMA; wd33c93_init(a3000_host, regs, dma_setup, dma_stop, WD33C93_FS_12_15); if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, "A3000 SCSI", a3000_intr)) goto fail_irq; DMA(a3000_host)->CNTR = CNTR_PDMD | CNTR_INTEN; return 1; fail_irq: wd33c93_release(); scsi_unregister(a3000_host); fail_register: release_mem_region(0xDD0000, 256); return 0; }
/***************************************************************** Detection */ int fastlane_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; const struct ConfigDev *esp_dev; unsigned int key; unsigned long address; if ((key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060, 0, 0))){ esp_dev = zorro_get_board(key); /* Check if this is really a fastlane controller. The problem * is that also the cyberstorm and blizzard controllers use * this ID value. Fortunately only Fastlane maps in Z3 space */ if((unsigned long)esp_dev->cd_BoardAddr < 0x1000000) return 0; esp = esp_allocate(tpnt, (void *) esp_dev); /* 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 = &dma_irq_exit; esp->dma_led_on = &dma_led_on; esp->dma_led_off = &dma_led_off; esp->dma_poll = 0; esp->dma_reset = 0; /* Initialize the portBits (enable IRQs) */ ctrl_data = (FASTLANE_DMA_FCODE | #ifndef NODMAIRQ FASTLANE_DMA_EDI | #endif FASTLANE_DMA_ESI); /* SCSI chip clock */ esp->cfreq = 40000000; /* Map the physical address space into virtual kernel space */ address = (unsigned long) kernel_map((unsigned long)esp_dev->cd_BoardAddr, esp_dev->cd_BoardSize, KERNELMAP_NOCACHE_SER, NULL); if(!address){ printk("Could not remap Fastlane controller memory!"); scsi_unregister (esp->ehost); return 0; } /* The DMA registers on the Fastlane are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ esp->dregs = (void *)(address + FASTLANE_DMA_ADDR); /* ESP register base */ esp->eregs = (struct ESP_regs *)(address + FASTLANE_ESP_ADDR); /* Board base */ esp->edev = (void *) address; /* Set the command buffer */ esp->esp_command = (volatile unsigned char*) cmd_buffer; esp->esp_command_dvma = virt_to_bus((unsigned long) cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; request_irq(IRQ_AMIGA_PORTS, esp_intr, 0, "Fastlane SCSI", esp_intr); /* Controller ID */ esp->scsi_id = 7; /* Check for differential SCSI-bus */ /* What is this stuff? */ esp->diff = 0; dma_clear(esp); esp_initialize(esp); zorro_config_board(key, 0); printk("\nESP: 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 fastlane_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; struct zorro_dev *z = NULL; unsigned long address; if ((z = zorro_find_device(ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060, z))) { unsigned long board = z->resource.start; if (request_mem_region(board+FASTLANE_ESP_ADDR, sizeof(struct ESP_regs), "NCR53C9x")) { /* Check if this is really a fastlane controller. The problem * is that also the cyberstorm and blizzard controllers use * this ID value. Fortunately only Fastlane maps in Z3 space */ if (board < 0x1000000) { goto err_release; } esp = esp_allocate(tpnt, (void *)board+FASTLANE_ESP_ADDR); /* 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 = &dma_irq_exit; esp->dma_led_on = &dma_led_on; esp->dma_led_off = &dma_led_off; esp->dma_poll = 0; esp->dma_reset = 0; /* Initialize the portBits (enable IRQs) */ ctrl_data = (FASTLANE_DMA_FCODE | #ifndef NODMAIRQ FASTLANE_DMA_EDI | #endif FASTLANE_DMA_ESI); /* SCSI chip clock */ esp->cfreq = 40000000; /* Map the physical address space into virtual kernel space */ address = (unsigned long) ioremap_nocache(board, z->resource.end-board+1); if(!address){ printk("Could not remap Fastlane controller memory!"); goto err_unregister; } /* The DMA registers on the Fastlane are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ esp->dregs = (void *)(address + FASTLANE_DMA_ADDR); /* ESP register base */ esp->eregs = (struct ESP_regs *)(address + FASTLANE_ESP_ADDR); /* Board base */ esp->edev = (void *) address; /* Set the command buffer */ esp->esp_command = (volatile unsigned char*) cmd_buffer; esp->esp_command_dvma = virt_to_bus(cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; esp->slot = board+FASTLANE_ESP_ADDR; if (request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, "Fastlane SCSI", esp_intr)) { printk(KERN_WARNING "Fastlane: Could not get IRQ%d, aborting.\n", IRQ_AMIGA_PORTS); goto err_unmap; } /* Controller ID */ esp->scsi_id = 7; /* We don't have a differential SCSI-bus. */ esp->diff = 0; dma_clear(esp); 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_unmap: iounmap((void *)address); err_unregister: scsi_unregister (esp->ehost); err_release: release_mem_region(z->resource.start+FASTLANE_ESP_ADDR, sizeof(struct ESP_regs)); return 0; }
int atari_scsi_detect (Scsi_Host_Template *host) { static int called = 0; struct Scsi_Host *instance; if (!MACH_IS_ATARI || (!ATARIHW_PRESENT(ST_SCSI) && !ATARIHW_PRESENT(TT_SCSI)) || called) return( 0 ); host->proc_name = "Atari"; atari_scsi_reg_read = IS_A_TT() ? atari_scsi_tt_reg_read : atari_scsi_falcon_reg_read; atari_scsi_reg_write = IS_A_TT() ? atari_scsi_tt_reg_write : atari_scsi_falcon_reg_write; /* setup variables */ host->can_queue = (setup_can_queue > 0) ? setup_can_queue : IS_A_TT() ? ATARI_TT_CAN_QUEUE : ATARI_FALCON_CAN_QUEUE; host->cmd_per_lun = (setup_cmd_per_lun > 0) ? setup_cmd_per_lun : IS_A_TT() ? ATARI_TT_CMD_PER_LUN : ATARI_FALCON_CMD_PER_LUN; /* Force sg_tablesize to 0 on a Falcon! */ host->sg_tablesize = !IS_A_TT() ? ATARI_FALCON_SG_TABLESIZE : (setup_sg_tablesize >= 0) ? setup_sg_tablesize : ATARI_TT_SG_TABLESIZE; if (setup_hostid >= 0) host->this_id = setup_hostid; else { /* use 7 as default */ host->this_id = 7; /* Test if a host id is set in the NVRam */ if (ATARIHW_PRESENT(TT_CLK) && nvram_check_checksum()) { unsigned char b = nvram_read_byte( 14 ); /* Arbitration enabled? (for TOS) If yes, use configured host ID */ if (b & 0x80) host->this_id = b & 7; } } #ifdef SUPPORT_TAGS if (setup_use_tagged_queuing < 0) setup_use_tagged_queuing = DEFAULT_USE_TAGGED_QUEUING; #endif #ifdef REAL_DMA /* If running on a Falcon and if there's TT-Ram (i.e., more than one * memory block, since there's always ST-Ram in a Falcon), then allocate a * STRAM_BUFFER_SIZE byte dribble buffer for transfers from/to alternative * Ram. */ if (MACH_IS_ATARI && ATARIHW_PRESENT(ST_SCSI) && !ATARIHW_PRESENT(EXTD_DMA) && m68k_num_memory > 1) { atari_dma_buffer = atari_stram_alloc(STRAM_BUFFER_SIZE, "SCSI"); if (!atari_dma_buffer) { printk( KERN_ERR "atari_scsi_detect: can't allocate ST-RAM " "double buffer\n" ); return( 0 ); } atari_dma_phys_buffer = virt_to_phys( atari_dma_buffer ); atari_dma_orig_addr = 0; } #endif instance = scsi_register (host, sizeof (struct NCR5380_hostdata)); if(instance == NULL) { atari_stram_free(atari_dma_buffer); atari_dma_buffer = 0; return 0; } atari_scsi_host = instance; /* Set irq to 0, to avoid that the mid-level code disables our interrupt * during queue_command calls. This is completely unnecessary, and even * worse causes bad problems on the Falcon, where the int is shared with * IDE and floppy! */ instance->irq = 0; #ifdef CONFIG_ATARI_SCSI_RESET_BOOT atari_scsi_reset_boot(); #endif NCR5380_init (instance, 0); if (IS_A_TT()) { /* This int is actually "pseudo-slow", i.e. it acts like a slow * interrupt after having cleared the pending flag for the DMA * interrupt. */ if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW, "SCSI NCR5380", scsi_tt_intr)) { printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI); scsi_unregister(atari_scsi_host); atari_stram_free(atari_dma_buffer); atari_dma_buffer = 0; return 0; } tt_mfp.active_edge |= 0x80; /* SCSI int on L->H */ #ifdef REAL_DMA tt_scsi_dma.dma_ctrl = 0; atari_dma_residual = 0; #ifdef CONFIG_TT_DMA_EMUL if (MACH_IS_HADES) { if (request_irq(IRQ_AUTO_2, hades_dma_emulator, IRQ_TYPE_PRIO, "Hades DMA emulator", hades_dma_emulator)) { printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2); free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); scsi_unregister(atari_scsi_host); atari_stram_free(atari_dma_buffer); atari_dma_buffer = 0; return 0; } } #endif if (MACH_IS_MEDUSA || MACH_IS_HADES) { /* While the read overruns (described by Drew Eckhardt in * NCR5380.c) never happened on TTs, they do in fact on the Medusa * (This was the cause why SCSI didn't work right for so long * there.) Since handling the overruns slows down a bit, I turned * the #ifdef's into a runtime condition. * * In principle it should be sufficient to do max. 1 byte with * PIO, but there is another problem on the Medusa with the DMA * rest data register. So 'atari_read_overruns' is currently set * to 4 to avoid having transfers that aren't a multiple of 4. If * the rest data bug is fixed, this can be lowered to 1. */ atari_read_overruns = 4; } #endif /*REAL_DMA*/ } else { /* ! IS_A_TT */ /* Nothing to do for the interrupt: the ST-DMA is initialized * already by atari_init_INTS() */ #ifdef REAL_DMA atari_dma_residual = 0; atari_dma_active = 0; atari_dma_stram_mask = (ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000 : 0xff000000); #endif } printk(KERN_INFO "scsi%d: options CAN_QUEUE=%d CMD_PER_LUN=%d SCAT-GAT=%d " #ifdef SUPPORT_TAGS "TAGGED-QUEUING=%s " #endif "HOSTID=%d", instance->host_no, instance->hostt->can_queue, instance->hostt->cmd_per_lun, instance->hostt->sg_tablesize, #ifdef SUPPORT_TAGS setup_use_tagged_queuing ? "yes" : "no", #endif instance->hostt->this_id ); NCR5380_print_options (instance); printk ("\n"); called = 1; return( 1 ); }
/***************************************************************** 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; }
int tc2550_detect(Scsi_Host_Template * tpnt) { int flag = 0; int retcode; struct Scsi_Host *shpnt; unsigned long flags; unsigned int mod4; flag = tc2550_pci_bios_detect(&interrupt_level, &port_base); if (!flag) return (0); init_chip_reg(); /* chip Tc-2550 initialize */ flag = download_RISC_code(); if (flag == 0) { printk(KERN_INFO "tc2550: Successful F/W download on TC-2550x\n"); } /* now do a scsi register and get scsi host ptr */ shpnt = scsi_register(tpnt, 0); save_flags(flags); cli(); retcode = request_irq(interrupt_level, tc2550_intr, SA_INTERRUPT, "tripace", NULL); if (retcode) { printk(KERN_ERR "tc2550: Unable to allocate IRQ for Tripace TC-2550x based SCSI Host Adapter.\n"); goto unregister; } /* For multiple HA we need to change all this */ tripace_host = shpnt; shpnt->io_port = CFG_BASE; shpnt->n_io_port = 0xfc; /* Number of bytes of I/O space used */ shpnt->dma_channel = 0; shpnt->irq = interrupt_level; restore_flags(flags); /* log i/o ports with the kernel */ request_region(port_base, 0xfc, "tripace"); /* when we support multiple HA ,we need to modify */ Init_struc(0); /* init mailboxes for one adapter */ /* sg table init */ /* get physical address */ startsgptr = (unsigned char *) table; pstartsgptr = virt_to_phys((unsigned char *) table); mod4 = pstartsgptr % 4; if (mod4) { pstartsgptr += (4 - mod4); startsgptr += (4 - mod4); } return (0); unregister: scsi_unregister(shpnt); return (0); }
/***************************************************************** 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; }
static int powertecscsi_probe(struct expansion_card *ec) { struct Scsi_Host *host; struct powertec_info *info; unsigned long base; int ret; base = ecard_address(ec, ECARD_IOC, ECARD_FAST); request_region(base + POWERTEC_FAS216_OFFSET, 16 << POWERTEC_FAS216_SHIFT, "powertec2-fas"); host = scsi_register(&powertecscsi_template, sizeof (struct powertec_info)); if (!host) { ret = -ENOMEM; goto out_region; } host->io_port = base; host->irq = ec->irq; host->dma_channel = ec->dma; ec->irqaddr = (unsigned char *)ioaddr(base + POWERTEC_INTR_STATUS); ec->irqmask = POWERTEC_INTR_BIT; ec->irq_data = (void *)(base + POWERTEC_INTR_CONTROL); ec->ops = (expansioncard_ops_t *)&powertecscsi_ops; info = (struct powertec_info *)host->hostdata; info->ec = ec; info->term_port = base + POWERTEC_TERM_CONTROL; powertecscsi_terminator_ctl(host, term[ec->slot_no]); info->info.scsi.io_port = host->io_port + POWERTEC_FAS216_OFFSET; info->info.scsi.io_shift = POWERTEC_FAS216_SHIFT; info->info.scsi.irq = host->irq; info->info.ifcfg.clockrate = 40; /* MHz */ info->info.ifcfg.select_timeout = 255; info->info.ifcfg.asyncperiod = 200; /* ns */ info->info.ifcfg.sync_max_depth = 7; info->info.ifcfg.cntl3 = CNTL3_BS8 | CNTL3_FASTSCSI | CNTL3_FASTCLK; info->info.ifcfg.disconnect_ok = 1; info->info.ifcfg.wide_max_size = 0; info->info.ifcfg.capabilities = 0; info->info.dma.setup = powertecscsi_dma_setup; info->info.dma.pseudo = NULL; info->info.dma.stop = powertecscsi_dma_stop; ret = fas216_init(host); if (ret) goto out_free; ret = request_irq(host->irq, powertecscsi_intr, SA_INTERRUPT, "powertec", &info->info); if (ret) { printk("scsi%d: IRQ%d not free: %d\n", host->host_no, host->irq, ret); goto out_release; } if (host->dma_channel != NO_DMA) { if (request_dma(host->dma_channel, "powertec")) { printk("scsi%d: DMA%d not free, using PIO\n", host->host_no, host->dma_channel); host->dma_channel = NO_DMA; } else { set_dma_speed(host->dma_channel, 180); info->info.ifcfg.capabilities |= FASCAP_DMA; } } ret = fas216_add(host); if (ret == 0) goto out; if (host->dma_channel != NO_DMA) free_dma(host->dma_channel); free_irq(host->irq, host); out_release: fas216_release(host); out_free: scsi_unregister(host); out_region: release_region(base + POWERTEC_FAS216_OFFSET, 16 << POWERTEC_FAS216_SHIFT); out: return ret; }
int mac53c94_detect(Scsi_Host_Template *tp) { struct device_node *node; int nfscs; struct fsc_state *state, **prev_statep; struct Scsi_Host *host; void *dma_cmd_space; unsigned char *clkprop; int proplen; struct pci_dev *pdev; u8 pbus, devfn; nfscs = 0; prev_statep = &all_53c94s; for (node = find_devices("53c94"); node != 0; node = node->next) { if (node->n_addrs != 2 || node->n_intrs != 2) { printk(KERN_ERR "mac53c94: expected 2 addrs and intrs" " (got %d/%d) for node %s\n", node->n_addrs, node->n_intrs, node->full_name); continue; } pdev = NULL; if (node->parent != NULL && !pci_device_from_OF_node(node->parent, &pbus, &devfn)) pdev = pci_find_slot(pbus, devfn); if (pdev == NULL) { printk(KERN_ERR "mac53c94: can't find PCI device " "for %s\n", node->full_name); continue; } host = scsi_register(tp, sizeof(struct fsc_state)); if (host == NULL) break; host->unique_id = nfscs; state = (struct fsc_state *) host->hostdata; if (state == 0) { /* "can't happen" */ printk(KERN_ERR "mac53c94: no state for %s?!\n", node->full_name); scsi_unregister(host); break; } state->host = host; state->pdev = pdev; state->regs = (volatile struct mac53c94_regs *) ioremap(node->addrs[0].address, 0x1000); state->intr = node->intrs[0].line; state->dma = (volatile struct dbdma_regs *) ioremap(node->addrs[1].address, 0x1000); state->dmaintr = node->intrs[1].line; if (state->regs == NULL || state->dma == NULL) { printk(KERN_ERR "mac53c94: ioremap failed for %s\n", node->full_name); if (state->dma != NULL) iounmap(state->dma); if (state->regs != NULL) iounmap(state->regs); scsi_unregister(host); break; } clkprop = get_property(node, "clock-frequency", &proplen); if (clkprop == NULL || proplen != sizeof(int)) { printk(KERN_ERR "%s: can't get clock frequency, " "assuming 25MHz\n", node->full_name); state->clk_freq = 25000000; } else state->clk_freq = *(int *)clkprop; /* Space for dma command list: +1 for stop command, +1 to allow for aligning. */ dma_cmd_space = kmalloc((host->sg_tablesize + 2) * sizeof(struct dbdma_cmd), GFP_KERNEL); if (dma_cmd_space == 0) { printk(KERN_ERR "mac53c94: couldn't allocate dma " "command space for %s\n", node->full_name); goto err_cleanup; } state->dma_cmds = (struct dbdma_cmd *) DBDMA_ALIGN(dma_cmd_space); memset(state->dma_cmds, 0, (host->sg_tablesize + 1) * sizeof(struct dbdma_cmd)); state->dma_cmd_space = dma_cmd_space; *prev_statep = state; prev_statep = &state->next; if (request_irq(state->intr, do_mac53c94_interrupt, 0, "53C94", state)) { printk(KERN_ERR "mac53C94: can't get irq %d for %s\n", state->intr, node->full_name); err_cleanup: iounmap(state->dma); iounmap(state->regs); scsi_unregister(host); break; } mac53c94_init(state); ++nfscs; } return nfscs; }
int __init sgiwd93_detect(Scsi_Host_Template *SGIblows) { static unsigned char called = 0; struct hpc3_scsiregs *hregs = &hpc3c0->scsi_chan0; struct hpc3_scsiregs *hregs1 = &hpc3c0->scsi_chan1; struct WD33C93_hostdata *hdata; struct WD33C93_hostdata *hdata1; wd33c93_regs regs; uchar *buf; if(called) return 0; /* Should bitch on the console about this... */ SGIblows->proc_name = "SGIWD93"; sgiwd93_host = scsi_register(SGIblows, sizeof(struct WD33C93_hostdata)); if(sgiwd93_host == NULL) return 0; sgiwd93_host->base = (unsigned long) hregs; sgiwd93_host->irq = SGI_WD93_0_IRQ; buf = (uchar *) get_zeroed_page(GFP_KERNEL); if (!buf) { printk(KERN_WARNING "sgiwd93: Could not allocate memory for host0 buffer.\n"); scsi_unregister(sgiwd93_host); return 0; } init_hpc_chain(buf); /* HPC_SCSI_REG0 | 0x03 | KSEG1 */ regs.SASR = (unsigned char*) KSEG1ADDR (0x1fbc0003); regs.SCMD = (unsigned char*) KSEG1ADDR (0x1fbc0007); wd33c93_init(sgiwd93_host, regs, dma_setup, dma_stop, WD33C93_FS_16_20); hdata = (struct WD33C93_hostdata *)sgiwd93_host->hostdata; hdata->no_sync = 0; hdata->dma_bounce_buffer = (uchar *) (KSEG1ADDR(buf)); if (request_irq(SGI_WD93_0_IRQ, sgiwd93_intr, 0, "SGI WD93", (void *) sgiwd93_host)) { printk(KERN_WARNING "sgiwd93: Could not register IRQ %d (for host 0).\n", SGI_WD93_0_IRQ); wd33c93_release(); free_page((unsigned long)buf); scsi_unregister(sgiwd93_host); return 0; } /* set up second controller on the Indigo2 */ if(!sgi_guiness) { sgiwd93_host1 = scsi_register(SGIblows, sizeof(struct WD33C93_hostdata)); if(sgiwd93_host1 != NULL) { sgiwd93_host1->base = (unsigned long) hregs1; sgiwd93_host1->irq = SGI_WD93_1_IRQ; buf = (uchar *) get_zeroed_page(GFP_KERNEL); if (!buf) { printk(KERN_WARNING "sgiwd93: Could not allocate memory for host1 buffer.\n"); scsi_unregister(sgiwd93_host1); called = 1; return 1; /* We registered host0 so return success*/ } init_hpc_chain(buf); /* HPC_SCSI_REG1 | 0x03 | KSEG1 */ regs.SASR = (unsigned char*) KSEG1ADDR(0x1fbc8003); regs.SCMD = (unsigned char*) KSEG1ADDR(0x1fbc8007); wd33c93_init(sgiwd93_host1, regs, dma_setup, dma_stop, WD33C93_FS_16_20); hdata1 = (struct WD33C93_hostdata *)sgiwd93_host1->hostdata; hdata1->no_sync = 0; hdata1->dma_bounce_buffer = (uchar *) (KSEG1ADDR(buf)); if (request_irq(SGI_WD93_1_IRQ, sgiwd93_intr, 0, "SGI WD93", (void *) sgiwd93_host1)) { printk(KERN_WARNING "sgiwd93: Could not allocate irq %d (for host1).\n", SGI_WD93_1_IRQ); wd33c93_release(); free_page((unsigned long)buf); scsi_unregister(sgiwd93_host1); /* Fall through since host0 registered OK */ } } } called = 1; return 1; /* Found one. */ }