diff options
author | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 1998-05-12 19:30:33 +0000 |
---|---|---|
committer | Thomas Bogendoerfer <tsbogend@alpha.franken.de> | 1998-05-12 19:30:33 +0000 |
commit | b4930b0d404da1157965de172686b7dbf14b5e99 (patch) | |
tree | 635b2c9019cc315ef692bd237bd09fb44ad11ef0 /drivers/scsi/NCR53C9x.c | |
parent | 3b23e8acfab7fa5522ce96c58335607fe235562a (diff) |
now NCR53C9x is used for the FAS216 on jazz boards
Diffstat (limited to 'drivers/scsi/NCR53C9x.c')
-rw-r--r-- | drivers/scsi/NCR53C9x.c | 154 |
1 files changed, 69 insertions, 85 deletions
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c index 81a3fab54..a6e2e51dc 100644 --- a/drivers/scsi/NCR53C9x.c +++ b/drivers/scsi/NCR53C9x.c @@ -395,12 +395,6 @@ static inline void esp_reset_esp(struct NCR_ESP *esp, struct ESP_regs *eregs) esp_cmd(esp, eregs, ESP_CMD_NULL | ESP_CMD_DMA); esp_cmd(esp, eregs, ESP_CMD_NULL | ESP_CMD_DMA); - /* Reload the configuration registers */ - eregs->esp_cfact = esp->cfact; - eregs->esp_stp = 0; - eregs->esp_soff = 0; - eregs->esp_timeo = esp->neg_defp; - /* This is the only point at which it is reliable to read * the ID-code for a fast ESP chip variant. */ @@ -417,7 +411,10 @@ static inline void esp_reset_esp(struct NCR_ESP *esp, struct ESP_regs *eregs) } #endif if(family_code == 0x02) - esp->erev = fas236; + if ((version & 7) == 2) + esp->erev = fas216; + else + esp->erev = fas236; else if(family_code == 0x0a) esp->erev = fashme; /* Version is usually '5'. */ else @@ -425,13 +422,20 @@ static inline void esp_reset_esp(struct NCR_ESP *esp, struct ESP_regs *eregs) printk("esp%d: FAST chip is %s (family=%d, version=%d)\n", esp->esp_id, (esp->erev == fas236) ? "fas236" : - ((esp->erev == fas100a) ? "fas100a" : - "fasHME"), family_code, (version & 7)); + ((esp->erev == fas216) ? "fas216" : + (((esp->erev == fas100a) ? "fas100a" : + "fasHME"))), family_code, (version & 7)); esp->min_period = ((4 * esp->ccycle) / 1000); } else { esp->min_period = ((5 * esp->ccycle) / 1000); } + + /* Reload the configuration registers */ + eregs->esp_cfact = esp->cfact; + eregs->esp_stp = 0; + eregs->esp_soff = 0; + eregs->esp_timeo = esp->neg_defp; esp->max_period = (esp->max_period + 3)>>2; esp->min_period = (esp->min_period + 3)>>2; @@ -451,6 +455,7 @@ static inline void esp_reset_esp(struct NCR_ESP *esp, struct ESP_regs *eregs) case fashme: esp->config2 |= (ESP_CONFIG2_HME32 | ESP_CONFIG2_HMEFENAB); /* fallthrough... */ + case fas216: case fas236: /* Fast 236 or HME */ eregs->esp_cfg2 = esp->config2; @@ -630,6 +635,9 @@ void esp_initialize(struct NCR_ESP *esp) esp->neg_defp = ESP_NEG_DEFP(fmhz, ccf); esp->sync_defp = SYNC_DEFP_SLOW; + printk("SCSI ID %d Clock %d MHz CCF=%d Time-Out %d ", + esp->scsi_id, (esp->cfreq / 1000000), + esp->ccf, (int) esp->neg_defp); /* Fill in ehost data */ esp->ehost->base = (unsigned char *) eregs; @@ -707,10 +715,6 @@ void esp_initialize(struct NCR_ESP *esp) esp_bootup_reset(esp, eregs); esps_in_use++; - - printk("SCSI ID %d Clock %d MHz CCF=%d Time-Out %d ", - esp->scsi_id, (esp->cfreq / 1000000), - esp->ccf, (int) esp->neg_defp); } /* The info function will return whatever useful @@ -724,17 +728,19 @@ const char *esp_info(struct Scsi_Host *host) esp = (struct NCR_ESP *) host->hostdata; switch(esp->erev) { case esp100: - return "Sparc ESP100 (NCR53C90)"; + return "ESP100 (NCR53C90)"; case esp100a: - return "Sparc ESP100A (NCR53C90A)"; + return "ESP100A (NCR53C90A)"; case esp236: - return "Sparc ESP236"; + return "ESP236"; + case fas216: + return "ESP216-FAST"; case fas236: - return "Sparc ESP236-FAST"; + return "ESP236-FAST"; case fashme: - return "Sparc ESP366-HME"; + return "ESP366-HME"; case fas100a: - return "Sparc ESP100A-FAST"; + return "ESP100A-FAST"; default: panic("Bogon ESP revision"); }; @@ -807,6 +813,9 @@ static int esp_host_info(struct NCR_ESP *esp, char *ptr, off_t offset, int len) case esp236: copy_info(&info, "ESP236\n"); break; + case fas216: + copy_info(&info, "FAS216\n"); + break; case fas236: copy_info(&info, "FAS236\n"); break; @@ -1252,20 +1261,11 @@ int esp_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; SCpnt->SCp.buffers_residual = 0; -#ifdef CONFIG_SCSI_SUNESP - /* Sneaky. */ - SCpnt->SCp.have_data_in = mmu_get_scsi_one((char *)SCpnt->SCp.buffer, - SCpnt->SCp.this_residual, - ((struct linux_sbus_device*) (esp->edev))->my_bus); - /* XXX The casts are extremely gross, but with 64-bit kernel - * XXX and 32-bit SBUS what am I to do? -DaveM - */ - SCpnt->SCp.ptr = (char *)((unsigned long)SCpnt->SCp.have_data_in); -#else - SCpnt->SCp.have_data_in = (int) SCpnt->SCp.ptr = - (char *) VTOP((unsigned long) SCpnt->request_buffer); -#endif - + if (esp->dma_mmu_get_scsi_one) + esp->dma_mmu_get_scsi_one (esp, SCpnt); + else + SCpnt->SCp.have_data_in = (int) SCpnt->SCp.ptr = + (char *) virt_to_phys(SCpnt->request_buffer); } else { ESPQUEUE(("use_sg ")); #ifdef DEBUG_ESP_SG @@ -1275,16 +1275,11 @@ int esp_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->buffer; SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length; -#ifdef CONFIG_SCSI_SUNESP - mmu_get_scsi_sgl((struct mmu_sglist *) SCpnt->SCp.buffer, - SCpnt->SCp.buffers_residual, - ((struct linux_sbus_device *) (esp->edev))->my_bus); - /* XXX Again these casts are sick... -DaveM */ - SCpnt->SCp.ptr=(char *)((unsigned long)SCpnt->SCp.buffer->dvma_address); -#else - SCpnt->SCp.ptr = - (char *) VTOP((unsigned long) SCpnt->SCp.buffer->address); -#endif + if (esp->dma_mmu_get_scsi_sgl) + esp->dma_mmu_get_scsi_sgl (esp, SCpnt); + else + SCpnt->SCp.ptr = + (char *) virt_to_phys(SCpnt->SCp.buffer->address); } SCpnt->SCp.Status = CHECK_CONDITION; SCpnt->SCp.Message = 0xff; @@ -1481,21 +1476,14 @@ static void esp_done(struct NCR_ESP *esp, int error) /* Free dvma entry. */ if(!done_SC->use_sg) { -#ifdef CONFIG_SCSI_SUNESP - /* Sneaky. */ - mmu_release_scsi_one(done_SC->SCp.have_data_in, - done_SC->request_bufflen, - ((struct linux_sbus_device *) (esp->edev))->my_bus); -#endif + if (esp->dma_mmu_release_scsi_one) + esp->dma_mmu_release_scsi_one (esp, done_SC); } else { #ifdef DEBUG_ESP_SG printk("esp%d: unmapping sg ", esp->esp_id); #endif -#ifdef CONFIG_SCSI_SUNESP - mmu_release_scsi_sgl((struct mmu_sglist *) done_SC->buffer, - done_SC->use_sg - 1, - ((struct linux_sbus_device *) (esp->edev))->my_bus); -#endif + if (esp->dma_mmu_release_scsi_sgl) + esp->dma_mmu_release_scsi_sgl (esp, done_SC); #ifdef DEBUG_ESP_SG printk("done.\n"); #endif @@ -1861,16 +1849,15 @@ static inline int esp_do_msgin(struct NCR_ESP *esp, struct ESP_regs *eregs) return do_work_bus; } -static inline void advance_sg(Scsi_Cmnd *sp) +static inline void advance_sg(struct NCR_ESP *esp, Scsi_Cmnd *sp) { ++sp->SCp.buffer; --sp->SCp.buffers_residual; sp->SCp.this_residual = sp->SCp.buffer->length; -#ifdef CONFIG_SCSI_SUNESP - sp->SCp.ptr = (char *)((unsigned long)sp->SCp.buffer->dvma_address); -#else - sp->SCp.ptr = (char *)VTOP((unsigned long) sp->SCp.buffer->address); -#endif + if (esp->dma_advance_sg) + esp->dma_advance_sg (sp); + else + sp->SCp.ptr = (char *)virt_to_phys(sp->SCp.buffer->address); } /* Please note that the way I've coded these routines is that I _always_ @@ -2067,7 +2054,7 @@ static inline int esp_do_data_finale(struct NCR_ESP *esp, * figure this out. */ if(SCptr->use_sg && !SCptr->SCp.this_residual) - advance_sg(SCptr); + advance_sg(esp, SCptr); if(sreg_datainp(esp->sreg) || sreg_dataoutp(esp->sreg)) { ESPDATA(("to more data\n")); return esp_do_data(esp, eregs); @@ -2922,6 +2909,7 @@ static inline int check_multibyte_msg(struct NCR_ESP *esp, tmp = esp->ccycle / 1000; regval = (((period << 2) + tmp - 1) / tmp); if(regval && ((esp->erev == fas100a || + esp->erev == fas216 || esp->erev == fas236 || esp->erev == fashme))) { if(period >= 50) @@ -2934,7 +2922,7 @@ static inline int check_multibyte_msg(struct NCR_ESP *esp, SDptr->sync_min_period = (regval & 0x1f); SDptr->sync_max_offset = (offset | esp->radelay); - if((esp->erev == fas100a || esp->erev == fas236 || esp->erev == fashme)) { + if((esp->erev == fas100a || esp->erev == fas216 || esp->erev == fas236 || esp->erev == fashme)) { if((esp->erev == fas100a) || (esp->erev == fashme)) bit = ESP_CONFIG3_FAST; else @@ -2963,7 +2951,7 @@ static inline int check_multibyte_msg(struct NCR_ESP *esp, SDptr->sync_min_period = 0; eregs->esp_soff = 0; eregs->esp_stp = 0; - if((esp->erev == fas100a || esp->erev == fas236 || esp->erev == fashme)) { + if((esp->erev == fas100a || esp->erev == fas216 || esp->erev == fas236 || esp->erev == fashme)) { if((esp->erev == fas100a) || (esp->erev == fashme)) bit = ESP_CONFIG3_FAST; else @@ -3595,17 +3583,13 @@ again: if(esp->current_SC) { Scsi_Cmnd *SCptr = esp->current_SC; -#ifdef CONFIG_SCSI_SUNESP - if(!SCptr->use_sg) - mmu_release_scsi_one(SCptr->SCp.have_data_in, - SCptr->request_bufflen, - ((struct linux_sbus_device *) (esp->edev))->my_bus); - else - mmu_release_scsi_sgl((struct mmu_sglist *) - SCptr->buffer, - SCptr->use_sg - 1, - ((struct linux_sbus_device *) (esp->edev))->my_bus); -#endif + if(!SCptr->use_sg) { + if (esp->dma_mmu_release_scsi_one) + esp->dma_mmu_release_scsi_one (esp, SCptr); + } else { + if (esp->dma_mmu_release_scsi_sgl) + esp->dma_mmu_release_scsi_sgl (esp, SCptr); + } SCptr->result = (DID_RESET << 16); SCptr->scsi_done(SCptr); @@ -3614,17 +3598,13 @@ again: if(esp->disconnected_SC) { Scsi_Cmnd *SCptr; while((SCptr = remove_first_SC(&esp->disconnected_SC))) { - if(!SCptr->use_sg) -#ifdef CONFIG_SCSI_SUNESP - mmu_release_scsi_one(SCptr->SCp.have_data_in, - SCptr->request_bufflen, - ((struct linux_sbus_device *) (esp->edev))->my_bus); - else - mmu_release_scsi_sgl((struct mmu_sglist *) - SCptr->buffer, - SCptr->use_sg - 1, - ((struct linux_sbus_device *) (esp->edev))->my_bus); -#endif + if(!SCptr->use_sg) { + if (esp->dma_mmu_release_scsi_one) + esp->dma_mmu_release_scsi_one (esp, SCptr); + } else { + if (esp->dma_mmu_release_scsi_sgl) + esp->dma_mmu_release_scsi_sgl (esp, SCptr); + } SCptr->result = (DID_RESET << 16); SCptr->scsi_done(SCptr); @@ -3671,7 +3651,9 @@ void esp_intr(int irq, void *dev_id, struct pt_regs *pregs) repeat: again = 0; for_each_esp(esp) { +#ifndef __mips__ if(((esp)->irq & 0xf) == irq) { +#endif if(esp->dma_irq_p(esp)) { again = 1; @@ -3683,7 +3665,9 @@ repeat: esp->dma_ints_on(esp); } +#ifndef __mips__ } +#endif } if(again) goto repeat; |