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; }
int oakscsi_detect(Scsi_Host_Template * tpnt) { int count = 0; struct Scsi_Host *instance; tpnt->proc_name = "oakscsi"; memset (ecs, 0, sizeof (ecs)); ecard_startfind (); while(1) { if ((ecs[count] = ecard_find(0, oakscsi_cids)) == NULL) break; instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); instance->io_port = OAK_ADDRESS(ecs[count]); instance->irq = OAK_IRQ(ecs[count]); NCR5380_init(instance, 0); ecard_claim(ecs[count]); instance->n_io_port = 255; request_region (instance->io_port, instance->n_io_port, "Oak SCSI"); if (instance->irq != IRQ_NONE) if (request_irq(instance->irq, do_oakscsi_intr, SA_INTERRUPT, "Oak SCSI", 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 %lX 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", tpnt->can_queue, tpnt->cmd_per_lun, OAKSCSI_PUBLIC_RELEASE); printk("\nscsi%d:", instance->host_no); NCR5380_print_options(instance); printk("\n"); ++count; } #ifdef MODULE if(count == 0) printk("No oak scsi devices found\n"); #endif return count; }
static int __devinit cumanascsi1_probe(struct expansion_card *ec, const struct ecard_id *id) { struct Scsi_Host *host; int ret = -ENOMEM; host = scsi_host_alloc(&cumanascsi_template, sizeof(struct NCR5380_hostdata)); if (!host) goto out; host->io_port = ecard_address(ec, ECARD_IOC, ECARD_SLOW) + 0x800; host->irq = ec->irq; NCR5380_init(host, 0); host->n_io_port = 255; if (!(request_region(host->io_port, host->n_io_port, "CumanaSCSI-1"))) { ret = -EBUSY; goto out_free; } ((struct NCR5380_hostdata *)host->hostdata)->ctrl = 0; outb(0x00, host->io_port - 577); ret = request_irq(host->irq, cumanascsi_intr, SA_INTERRUPT, "CumanaSCSI-1", host); if (ret) { printk("scsi%d: IRQ%d not free: %d\n", host->host_no, host->irq, ret); goto out_release; } printk("scsi%d: at port 0x%08lx irq %d", host->host_no, host->io_port, host->irq); printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", host->can_queue, host->cmd_per_lun, CUMANASCSI_PUBLIC_RELEASE); printk("\nscsi%d:", host->host_no); NCR5380_print_options(host); printk("\n"); ret = scsi_add_host(host, &ec->dev); if (ret) goto out_free_irq; scsi_scan_host(host); goto out; out_free_irq: free_irq(host->irq, host); out_release: release_region(host->io_port, host->n_io_port); out_free: scsi_host_put(host); out: return ret; }
int cumanascsi_detect(Scsi_Host_Template * tpnt) { int count = 0; struct Scsi_Host *instance; tpnt->proc_name = "CumanaSCSI-1"; memset (ecs, 0, sizeof (ecs)); while(1) { if((ecs[count] = ecard_find(0, cumanascsi_cids)) == NULL) break; instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); instance->io_port = CUMANA_ADDRESS(ecs[count]); instance->irq = CUMANA_IRQ(ecs[count]); NCR5380_init(instance, 0); ecard_claim(ecs[count]); instance->n_io_port = 255; request_region (instance->io_port, instance->n_io_port, "CumanaSCSI-1"); ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; outb(0x00, instance->io_port - 577); if (instance->irq != IRQ_NONE) if (request_irq(instance->irq, do_cumanascsi_intr, SA_INTERRUPT, "CumanaSCSI-1", 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: interrupts not enabled. for better interactive performance,\n", instance->host_no); printk("scsi%d: please jumper the board for a free IRQ.\n", instance->host_no); } printk("scsi%d: at port %lX 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", tpnt->can_queue, tpnt->cmd_per_lun, CUMANASCSI_PUBLIC_RELEASE); printk("\nscsi%d:", instance->host_no); NCR5380_print_options(instance); printk("\n"); ++count; } return count; }
static int __devinit oakscsi_probe(struct expansion_card *ec, const struct ecard_id *id) { struct Scsi_Host *host; int ret = -ENOMEM; ret = ecard_request_resources(ec); if (ret) goto out; host = scsi_host_alloc(&oakscsi_template, sizeof(struct NCR5380_hostdata)); if (!host) { ret = -ENOMEM; goto release; } priv(host)->base = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), ecard_resource_len(ec, ECARD_RES_MEMC)); if (!priv(host)->base) { ret = -ENOMEM; goto unreg; } host->irq = IRQ_NONE; host->n_io_port = 255; NCR5380_init(host, 0); printk("scsi%d: at port 0x%08lx irqs disabled", host->host_no, host->io_port); printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", host->can_queue, host->cmd_per_lun, OAKSCSI_PUBLIC_RELEASE); printk("\nscsi%d:", host->host_no); NCR5380_print_options(host); printk("\n"); ret = scsi_add_host(host, &ec->dev); if (ret) goto out_unmap; scsi_scan_host(host); goto out; out_unmap: iounmap(priv(host)->base); unreg: scsi_host_put(host); release: ecard_release_resources(ec); out: return ret; }
static int __devinit oakscsi_probe(struct expansion_card *ec, const struct ecard_id *id) { struct Scsi_Host *host; int ret = -ENOMEM; host = scsi_host_alloc(&oakscsi_template, sizeof(struct NCR5380_hostdata)); if (!host) goto out; host->io_port = ecard_address(ec, ECARD_MEMC, 0); host->irq = IRQ_NONE; host->n_io_port = 255; ret = -EBUSY; if (!request_region (host->io_port, host->n_io_port, "Oak SCSI")) goto unreg; NCR5380_init(host, 0); printk("scsi%d: at port 0x%08lx irqs disabled", host->host_no, host->io_port); printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", host->can_queue, host->cmd_per_lun, OAKSCSI_PUBLIC_RELEASE); printk("\nscsi%d:", host->host_no); NCR5380_print_options(host); printk("\n"); ret = scsi_add_host(host, &ec->dev); if (ret) goto out_release; scsi_scan_host(host); goto out; out_release: release_region(host->io_port, host->n_io_port); unreg: scsi_host_put(host); out: return ret; }
static int sun3scsi_detect(struct scsi_host_template * tpnt) { unsigned long ioaddr, irq = 0; static int called = 0; struct Scsi_Host *instance; int i; unsigned long addrs[3] = { IOBASE_SUN3_VMESCSI, IOBASE_SUN3_VMESCSI + 0x4000, 0 }; unsigned long vecs[3] = { SUN3_VEC_VMESCSI0, SUN3_VEC_VMESCSI1, 0 }; /* check that this machine has an onboard 5380 */ switch(idprom->id_machtype) { case SM_SUN3|SM_3_160: case SM_SUN3|SM_3_260: break; default: return 0; } if(called) return 0; tpnt->proc_name = "Sun3 5380 VME SCSI"; /* setup variables */ tpnt->can_queue = (setup_can_queue > 0) ? setup_can_queue : CAN_QUEUE; tpnt->cmd_per_lun = (setup_cmd_per_lun > 0) ? setup_cmd_per_lun : CMD_PER_LUN; tpnt->sg_tablesize = (setup_sg_tablesize >= 0) ? setup_sg_tablesize : SG_TABLESIZE; if (setup_hostid >= 0) tpnt->this_id = setup_hostid; else { /* use 7 as default */ tpnt->this_id = 7; } ioaddr = 0; for(i = 0; addrs[i] != 0; i++) { unsigned char x; ioaddr = (unsigned long)sun3_ioremap(addrs[i], PAGE_SIZE, SUN3_PAGE_TYPE_VME16); irq = vecs[i]; sun3_scsi_regp = (unsigned char *)ioaddr; dregs = (struct sun3_dma_regs *)(((unsigned char *)ioaddr) + 8); if(sun3_map_test((unsigned long)dregs, &x)) { unsigned short oldcsr; oldcsr = dregs->csr; dregs->csr = 0; udelay(SUN3_DMA_DELAY); if(dregs->csr == 0x1400) break; dregs->csr = oldcsr; } iounmap((void *)ioaddr); ioaddr = 0; } if(!ioaddr) return 0; #ifdef SUPPORT_TAGS if (setup_use_tagged_queuing < 0) setup_use_tagged_queuing = USE_TAGGED_QUEUING; #endif instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); if(instance == NULL) return 0; default_instance = instance; instance->io_port = (unsigned long) ioaddr; instance->irq = irq; NCR5380_init(instance, 0); instance->n_io_port = 32; ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; if (request_irq(instance->irq, scsi_sun3_intr, 0, "Sun3SCSI-5380VME", instance)) { #ifndef REAL_DMA printk("scsi%d: IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = SCSI_IRQ_NONE; #else printk("scsi%d: IRQ%d not free, bailing out\n", instance->host_no, instance->irq); return 0; #endif } printk("scsi%d: Sun3 5380 VME at port %lX irq", instance->host_no, instance->io_port); if (instance->irq == SCSI_IRQ_NONE) printk ("s disabled"); else printk (" %d", instance->irq); printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", instance->can_queue, instance->cmd_per_lun, SUN3SCSI_PUBLIC_RELEASE); printk("\nscsi%d:", instance->host_no); NCR5380_print_options(instance); printk("\n"); dregs->csr = 0; udelay(SUN3_DMA_DELAY); dregs->csr = CSR_SCSI | CSR_FIFO | CSR_INTR; udelay(SUN3_DMA_DELAY); dregs->fifo_count = 0; dregs->fifo_count_hi = 0; dregs->dma_addr_hi = 0; dregs->dma_addr_lo = 0; dregs->dma_count_hi = 0; dregs->dma_count_lo = 0; dregs->ivect = VME_DATA24 | (instance->irq & 0xff); called = 1; #ifdef RESET_BOOT sun3_scsi_reset_boot(instance); #endif return 1; }
int sun3scsi_detect(Scsi_Host_Template * tpnt) { unsigned long ioaddr, iopte; int count = 0; static int called = 0; struct Scsi_Host *instance; if(called) return 0; tpnt->proc_name = "Sun3 5380 SCSI"; /* setup variables */ tpnt->can_queue = (setup_can_queue > 0) ? setup_can_queue : CAN_QUEUE; tpnt->cmd_per_lun = (setup_cmd_per_lun > 0) ? setup_cmd_per_lun : CMD_PER_LUN; tpnt->sg_tablesize = (setup_sg_tablesize >= 0) ? setup_sg_tablesize : SG_TABLESIZE; if (setup_hostid >= 0) tpnt->this_id = setup_hostid; else { /* use 7 as default */ tpnt->this_id = 7; } /* Taken from Sammy's lance driver: */ /* IOBASE_SUN3_SCSI can be found within the IO pmeg with some effort */ for(ioaddr = 0xfe00000; ioaddr < (0xfe00000 + SUN3_PMEG_SIZE); ioaddr += SUN3_PTE_SIZE) { iopte = sun3_get_pte(ioaddr); if(!(iopte & SUN3_PAGE_TYPE_IO)) /* this an io page? */ continue; if(((iopte & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT) == IOBASE_SUN3_SCSI) { count = 1; break; } } if(!count) { printk("No Sun3 NCR5380 found!\n"); return 0; } sun3_scsi_regp = (unsigned char *)ioaddr; dregs = (struct sun3_dma_regs *)(((unsigned char *)ioaddr) + 8); if((dmabuf = sun3_dvma_malloc(SUN3_DVMA_BUFSIZE)) == NULL) { printk("SUN3 Scsi couldn't allocate DVMA memory!\n"); return 0; } if((udc_regs = sun3_dvma_malloc(sizeof(struct sun3_udc_regs))) == NULL) { printk("SUN3 Scsi couldn't allocate DVMA memory!\n"); return 0; } #ifdef SUPPORT_TAGS if (setup_use_tagged_queuing < 0) setup_use_tagged_queuing = DEFAULT_USE_TAGGED_QUEUING; #endif instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); if(instance == NULL) return 0; default_instance = instance; instance->io_port = (unsigned long) ioaddr; instance->irq = IRQ_SUN3_SCSI; NCR5380_init(instance, 0); instance->n_io_port = 32; ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; if (request_irq(instance->irq, scsi_sun3_intr, 0, "Sun3SCSI-5380", NULL)) { #ifndef REAL_DMA printk("scsi%d: IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = IRQ_NONE; #else printk("scsi%d: IRQ%d not free, bailing out\n", instance->host_no, instance->irq); return 0; #endif } printk("scsi%d: Sun3 5380 at port %lX 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", instance->can_queue, instance->cmd_per_lun, SUN3SCSI_PUBLIC_RELEASE); printk("\nscsi%d:", instance->host_no); NCR5380_print_options(instance); printk("\n"); dregs->csr = 0; udelay(SUN3_DMA_DELAY); dregs->csr = CSR_SCSI | CSR_FIFO | CSR_INTR; udelay(SUN3_DMA_DELAY); dregs->fifo_count = 0; called = 1; return 1; }
int sun3scsi_detect(struct scsi_host_template * tpnt) { unsigned long ioaddr; static int called = 0; struct Scsi_Host *instance; /* check that this machine has an onboard 5380 */ switch(idprom->id_machtype) { case SM_SUN3|SM_3_50: case SM_SUN3|SM_3_60: break; default: return 0; } if(called) return 0; tpnt->proc_name = "Sun3 5380 SCSI"; /* setup variables */ tpnt->can_queue = (setup_can_queue > 0) ? setup_can_queue : CAN_QUEUE; tpnt->cmd_per_lun = (setup_cmd_per_lun > 0) ? setup_cmd_per_lun : CMD_PER_LUN; tpnt->sg_tablesize = (setup_sg_tablesize >= 0) ? setup_sg_tablesize : SG_TABLESIZE; if (setup_hostid >= 0) tpnt->this_id = setup_hostid; else { /* use 7 as default */ tpnt->this_id = 7; } ioaddr = (unsigned long)ioremap(IOBASE_SUN3_SCSI, PAGE_SIZE); sun3_scsi_regp = (unsigned char *)ioaddr; dregs = (struct sun3_dma_regs *)(((unsigned char *)ioaddr) + 8); if((udc_regs = dvma_malloc(sizeof(struct sun3_udc_regs))) == NULL) { printk("SUN3 Scsi couldn't allocate DVMA memory!\n"); return 0; } #ifdef OLDDMA if((dmabuf = dvma_malloc_align(SUN3_DVMA_BUFSIZE, 0x10000)) == NULL) { printk("SUN3 Scsi couldn't allocate DVMA memory!\n"); return 0; } #endif #ifdef SUPPORT_TAGS if (setup_use_tagged_queuing < 0) setup_use_tagged_queuing = USE_TAGGED_QUEUING; #endif instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); if(instance == NULL) return 0; default_instance = instance; instance->io_port = (unsigned long) ioaddr; instance->irq = IRQ_SUN3_SCSI; NCR5380_init(instance, 0); instance->n_io_port = 32; ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; if (request_irq(instance->irq, scsi_sun3_intr, 0, "Sun3SCSI-5380", instance)) { #ifndef REAL_DMA printk("scsi%d: IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = SCSI_IRQ_NONE; #else printk("scsi%d: IRQ%d not free, bailing out\n", instance->host_no, instance->irq); return 0; #endif } printk("scsi%d: Sun3 5380 at port %lX irq", instance->host_no, instance->io_port); if (instance->irq == SCSI_IRQ_NONE) printk ("s disabled"); else printk (" %d", instance->irq); printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", instance->can_queue, instance->cmd_per_lun, SUN3SCSI_PUBLIC_RELEASE); printk("\nscsi%d:", instance->host_no); NCR5380_print_options(instance); printk("\n"); dregs->csr = 0; udelay(SUN3_DMA_DELAY); dregs->csr = CSR_SCSI | CSR_FIFO | CSR_INTR; udelay(SUN3_DMA_DELAY); dregs->fifo_count = 0; called = 1; #ifdef RESET_BOOT sun3_scsi_reset_boot(instance); #endif return 1; }
int macscsi_detect(struct scsi_host_template * tpnt) { static int called = 0; int flags = 0; struct Scsi_Host *instance; if (!MACH_IS_MAC || called) return( 0 ); if (macintosh_config->scsi_type != MAC_SCSI_OLD) return( 0 ); /* setup variables */ tpnt->can_queue = (setup_can_queue > 0) ? setup_can_queue : CAN_QUEUE; tpnt->cmd_per_lun = (setup_cmd_per_lun > 0) ? setup_cmd_per_lun : CMD_PER_LUN; tpnt->sg_tablesize = (setup_sg_tablesize >= 0) ? setup_sg_tablesize : SG_TABLESIZE; if (setup_hostid >= 0) tpnt->this_id = setup_hostid; else { /* use 7 as default */ tpnt->this_id = 7; } #ifdef SUPPORT_TAGS if (setup_use_tagged_queuing < 0) setup_use_tagged_queuing = USE_TAGGED_QUEUING; #endif /* Once we support multiple 5380s (e.g. DuoDock) we'll do something different here */ instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); #if NDEBUG default_instance = instance; #endif if (macintosh_config->ident == MAC_MODEL_IIFX) { mac_scsi_regp = via1+0x8000; mac_scsi_drq = via1+0xE000; mac_scsi_nodrq = via1+0xC000; /* The IIFX should be able to do true DMA, but pseudo-dma doesn't work */ flags = FLAG_NO_PSEUDO_DMA; } else { mac_scsi_regp = via1+0x10000; mac_scsi_drq = via1+0x6000; mac_scsi_nodrq = via1+0x12000; } if (! setup_use_pdma) flags = FLAG_NO_PSEUDO_DMA; instance->io_port = (unsigned long) mac_scsi_regp; instance->irq = IRQ_MAC_SCSI; #ifdef RESET_BOOT mac_scsi_reset_boot(instance); #endif NCR5380_init(instance, flags); instance->n_io_port = 255; ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; if (instance->irq != SCSI_IRQ_NONE) if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW, "ncr5380", instance)) { printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = SCSI_IRQ_NONE; } printk(KERN_INFO "scsi%d: generic 5380 at port %lX irq", instance->host_no, instance->io_port); if (instance->irq == SCSI_IRQ_NONE) printk (KERN_INFO "s disabled"); else printk (KERN_INFO " %d", instance->irq); printk(KERN_INFO " options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", instance->can_queue, instance->cmd_per_lun, MACSCSI_PUBLIC_RELEASE); printk(KERN_INFO "\nscsi%d:", instance->host_no); NCR5380_print_options(instance); printk("\n"); called = 1; return 1; }
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 ); }
static int __devinit cumanascsi1_probe(struct expansion_card *ec, const struct ecard_id *id) { struct Scsi_Host *host; int ret; ret = ecard_request_resources(ec); if (ret) goto out; host = scsi_host_alloc(&cumanascsi_template, sizeof(struct NCR5380_hostdata)); if (!host) { ret = -ENOMEM; goto out_release; } priv(host)->base = ioremap(ecard_resource_start(ec, ECARD_RES_IOCSLOW), ecard_resource_len(ec, ECARD_RES_IOCSLOW)); priv(host)->dma = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), ecard_resource_len(ec, ECARD_RES_MEMC)); if (!priv(host)->base || !priv(host)->dma) { ret = -ENOMEM; goto out_unmap; } host->irq = ec->irq; NCR5380_init(host, 0); priv(host)->ctrl = 0; writeb(0, priv(host)->base + CTRL); host->n_io_port = 255; if (!(request_region(host->io_port, host->n_io_port, "CumanaSCSI-1"))) { ret = -EBUSY; goto out_unmap; } ret = request_irq(host->irq, cumanascsi_intr, IRQF_DISABLED, "CumanaSCSI-1", host); if (ret) { printk("scsi%d: IRQ%d not free: %d\n", host->host_no, host->irq, ret); goto out_unmap; } printk("scsi%d: at port 0x%08lx irq %d", host->host_no, host->io_port, host->irq); printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", host->can_queue, host->cmd_per_lun, CUMANASCSI_PUBLIC_RELEASE); printk("\nscsi%d:", host->host_no); NCR5380_print_options(host); printk("\n"); ret = scsi_add_host(host, &ec->dev); if (ret) goto out_free_irq; scsi_scan_host(host); goto out; out_free_irq: free_irq(host->irq, host); out_unmap: iounmap(priv(host)->base); iounmap(priv(host)->dma); scsi_host_put(host); out_release: ecard_release_resources(ec); out: return ret; }
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_dir = &proc_scsi_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)) { unsigned char sum = 0, b; int i; /* Make checksum */ for( i = 14; i < 62; ++i ) sum += RTC_READ(i); if (/* NV-Ram checksum valid? */ RTC_READ(62) == sum && RTC_READ(63) == ~sum && /* Arbitration enabled? (for TOS) */ (b = RTC_READ( 30 )) & 0x80) { host->this_id = b & 7; } } } #ifdef SUPPORT_TAGS if (setup_use_tagged_queuing < 0) setup_use_tagged_queuing = DEFAULT_USE_TAGGED_QUEUING; #endif /* 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) && boot_info.num_memory > 1) { atari_dma_buffer = scsi_init_malloc(STRAM_BUFFER_SIZE, GFP_ATOMIC | GFP_DMA); atari_dma_phys_buffer = VTOP( atari_dma_buffer ); atari_dma_orig_addr = 0; } instance = scsi_register (host, sizeof (struct NCR5380_hostdata)); atari_scsi_host = instance; instance->irq = IS_A_TT() ? IRQ_TT_MFP_SCSI : IRQ_MFP_FSCSI; atari_scsi_reset_boot(); 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. */ add_isr(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW, NULL, "SCSI NCR5380"); tt_mfp.active_edge |= 0x80; /* SCSI int on L->H */ #ifdef REAL_DMA tt_scsi_dma.dma_ctrl = 0; atari_dma_residual = 0; #endif /* REAL_DMA */ if (is_medusa) { /* 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; } } 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 ); }
int nbpmacscsi_detect(struct scsi_host_template * tpnt) { int flags = 0; struct Scsi_Host *instance; struct device_node *dp; const u32 *reg; if (called) return( 0 ); // dp = find_devices("5380"); dp = of_find_node_by_name(NULL, "5380"); if (!dp) return 0; reg = of_get_property(dp, "reg", NULL); if (reg == NULL) { printk(KERN_ERR "nbpmac5380: No \"reg\" property !\n"); of_node_put(dp); return 0; } tpnt->proc_name = "nbpmac5380"; /* setup variables */ tpnt->can_queue = (setup_can_queue > 0) ? setup_can_queue : CAN_QUEUE; tpnt->cmd_per_lun = (setup_cmd_per_lun > 0) ? setup_cmd_per_lun : CMD_PER_LUN; tpnt->sg_tablesize = (setup_sg_tablesize >= 0) ? setup_sg_tablesize : SG_TABLESIZE; if (setup_hostid >= 0) tpnt->this_id = setup_hostid; else /* use 7 as default */ tpnt->this_id = 7; #ifdef SUPPORT_TAGS if (setup_use_tagged_queuing < 0) setup_use_tagged_queuing = USE_TAGGED_QUEUING; #endif /* Once we support multiple 5380s (e.g. DuoDock) we'll do something different here */ instance = scsi_register (tpnt, sizeof(struct NCR5380_hostdata)); #if NDEBUG default_instance = instance; #endif /* mac68k source says multiple device support is broken */ mac_scsi_regp = (volatile unsigned char *) of_iomap(dp, 0); mac_scsi_drq = (volatile unsigned char *) of_iomap(dp, 1); mac_scsi_nodrq = (volatile unsigned char *) of_iomap(dp, 2); if (! setup_use_pdma) flags = FLAG_NO_PSEUDO_DMA; instance->io_port = (unsigned long) mac_scsi_regp; instance->irq = irq_of_parse_and_map(dp, 0); instance->n_io_port = 255; ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; if (instance->irq != SCSI_IRQ_NONE) if (request_irq(instance->irq, NCR5380_intr, 0, "ncr5380", instance)) { printk("scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = SCSI_IRQ_NONE; } #ifdef DRQ_INTERRUPT drq = irq_of_parse_and_map(vias, 1); request_irq(drq, macscsi_dma_intr, 0, "ncr5380 DRQ", instance); #endif of_node_put(dp); #ifdef RESET_BOOT mac_scsi_reset_boot(instance); #endif flags |= FLAG_HAS_LAST_BYTE_SENT; NCR5380_init(instance, flags); printk(KERN_INFO "scsi%d : generic 5380 at port %lX irq", instance->host_no, instance->io_port); if (instance->irq == SCSI_IRQ_NONE) printk (KERN_INFO "s disabled"); else printk (KERN_INFO " %d", instance->irq); printk(KERN_INFO " options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d", instance->can_queue, instance->cmd_per_lun, MACSCSI_PUBLIC_RELEASE); printk(KERN_INFO "\nscsi%d :", instance->host_no); NCR5380_print_options(instance); printk("\n"); called = 1; return 1; }