X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fscsi%2Fa2091.c;h=5ac3a3e8dfafcb57020edf4855690f0961550703;hb=8aae18adb240a9eb1999b8245c56522cbefc9047;hp=9928a2fbce0cd315d6ea7b609b3ace5442b3dd87;hpb=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index 9928a2f..5ac3a3e 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c @@ -1,8 +1,6 @@ #include #include #include -#include -#include #include #include @@ -25,7 +23,7 @@ #define DMA(ptr) ((a2091_scsiregs *)((ptr)->base)) #define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) -static irqreturn_t a2091_intr (int irq, void *_instance, struct pt_regs *fp) +static irqreturn_t a2091_intr (int irq, void *_instance) { unsigned long flags; unsigned int status; @@ -41,15 +39,14 @@ static irqreturn_t a2091_intr (int irq, void *_instance, struct pt_regs *fp) return IRQ_HANDLED; } -static int dma_setup (Scsi_Cmnd *cmd, int dir_in) +static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); struct Scsi_Host *instance = cmd->device->host; /* don't allow DMA if the physical address is bad */ - if (addr & A2091_XFER_MASK || - (!dir_in && mm_end_of_chunk (addr, cmd->SCp.this_residual))) + if (addr & A2091_XFER_MASK) { HDATA(instance)->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; @@ -75,18 +72,9 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) } if (!dir_in) { - /* copy to bounce buffer for a write */ - if (cmd->use_sg) -#if 0 - panic ("scsi%ddma: incomplete s/g support", - instance->host_no); -#else + /* copy to bounce buffer for a write */ memcpy (HDATA(instance)->dma_bounce_buffer, cmd->SCp.ptr, cmd->SCp.this_residual); -#endif - else - memcpy (HDATA(instance)->dma_bounce_buffer, - cmd->request_buffer, cmd->request_bufflen); } } @@ -116,7 +104,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) return 0; } -static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt, +static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { /* disable SCSI interrupts */ @@ -146,34 +134,17 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt, /* copy from a bounce buffer, if necessary */ if (status && HDATA(instance)->dma_bounce_buffer) { - if (SCpnt && SCpnt->use_sg) { -#if 0 - panic ("scsi%d: incomplete s/g support", - instance->host_no); -#else - if( HDATA(instance)->dma_dir ) + if( HDATA(instance)->dma_dir ) memcpy (SCpnt->SCp.ptr, HDATA(instance)->dma_bounce_buffer, SCpnt->SCp.this_residual); - kfree (HDATA(instance)->dma_bounce_buffer); - HDATA(instance)->dma_bounce_buffer = NULL; - HDATA(instance)->dma_bounce_len = 0; - -#endif - } else { - if (HDATA(instance)->dma_dir && SCpnt) - memcpy (SCpnt->request_buffer, - HDATA(instance)->dma_bounce_buffer, - SCpnt->request_bufflen); - - kfree (HDATA(instance)->dma_bounce_buffer); - HDATA(instance)->dma_bounce_buffer = NULL; - HDATA(instance)->dma_bounce_len = 0; - } + kfree (HDATA(instance)->dma_bounce_buffer); + HDATA(instance)->dma_bounce_buffer = NULL; + HDATA(instance)->dma_bounce_len = 0; } } -int __init a2091_detect(Scsi_Host_Template *tpnt) +int __init a2091_detect(struct scsi_host_template *tpnt) { static unsigned char called = 0; struct Scsi_Host *instance; @@ -209,7 +180,7 @@ int __init a2091_detect(Scsi_Host_Template *tpnt) regs.SASR = &(DMA(instance)->SASR); regs.SCMD = &(DMA(instance)->SCMD); wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10); - request_irq(IRQ_AMIGA_PORTS, a2091_intr, SA_SHIRQ, "A2091 SCSI", + request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, "A2091 SCSI", instance); DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; num_a2091++; @@ -218,16 +189,23 @@ int __init a2091_detect(Scsi_Host_Template *tpnt) return num_a2091; } -static int a2091_bus_reset(Scsi_Cmnd *cmd) +static int a2091_bus_reset(struct scsi_cmnd *cmd) { /* FIXME perform bus-specific reset */ + + /* FIXME 2: kill this function, and let midlayer fall back + to the same action, calling wd33c93_host_reset() */ + + spin_lock_irq(cmd->device->host->host_lock); wd33c93_host_reset(cmd); + spin_unlock_irq(cmd->device->host->host_lock); + return SUCCESS; } #define HOSTS_C -static Scsi_Host_Template driver_template = { +static struct scsi_host_template driver_template = { .proc_name = "A2901", .name = "Commodore A2091/A590 SCSI", .detect = a2091_detect,