X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fscsi%2Fa3000.c;h=6970ce82c4ac37a7ca03d1c456596e92fcb81922;hb=f653398c86a1c104f0992bd788dd4bb065449be4;hp=306caf56f3d9eaad59dea2916c42ca406abc5f67;hpb=df0ae2497ddefd72a87f3a3b34ff32455d7d4ae0;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index 306caf5..6970ce8 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -26,7 +25,9 @@ static struct Scsi_Host *a3000_host = NULL; -static irqreturn_t a3000_intr (int irq, void *dummy, struct pt_regs *fp) +static int a3000_release(struct Scsi_Host *instance); + +static irqreturn_t a3000_intr (int irq, void *dummy) { unsigned long flags; unsigned int status = DMA(a3000_host)->ISTR; @@ -44,7 +45,7 @@ static irqreturn_t a3000_intr (int irq, void *dummy, struct pt_regs *fp) return IRQ_NONE; } -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); @@ -55,8 +56,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) * end of a physical memory chunk, then allocate a bounce * buffer */ - if (addr & A3000_XFER_MASK || - (!dir_in && mm_end_of_chunk (addr, cmd->SCp.this_residual))) + if (addr & A3000_XFER_MASK) { HDATA(a3000_host)->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; @@ -71,12 +71,8 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) if (!dir_in) { /* copy to bounce buffer for a write */ - if (cmd->use_sg) { - memcpy (HDATA(a3000_host)->dma_bounce_buffer, - cmd->SCp.ptr, cmd->SCp.this_residual); - } else - memcpy (HDATA(a3000_host)->dma_bounce_buffer, - cmd->request_buffer, cmd->request_bufflen); + memcpy (HDATA(a3000_host)->dma_bounce_buffer, + cmd->SCp.ptr, cmd->SCp.this_residual); } addr = virt_to_bus(HDATA(a3000_host)->dma_bounce_buffer); @@ -110,8 +106,8 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) return 0; } -static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt, - int status) +static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, + int status) { /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; @@ -147,7 +143,7 @@ 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 (SCpnt) { if (HDATA(instance)->dma_dir && SCpnt) memcpy (SCpnt->SCp.ptr, HDATA(instance)->dma_bounce_buffer, @@ -156,11 +152,6 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt, HDATA(instance)->dma_bounce_buffer = NULL; HDATA(instance)->dma_bounce_len = 0; } 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; @@ -168,7 +159,7 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt, } } -int __init a3000_detect(Scsi_Host_Template *tpnt) +static int __init a3000_detect(struct scsi_host_template *tpnt) { wd33c93_regs regs; @@ -189,8 +180,11 @@ int __init a3000_detect(Scsi_Host_Template *tpnt) 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, SA_SHIRQ, "A3000 SCSI", + 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; @@ -205,7 +199,7 @@ fail_register: return 0; } -static int a3000_bus_reset(Scsi_Cmnd *cmd) +static int a3000_bus_reset(struct scsi_cmnd *cmd) { /* FIXME perform bus-specific reset */ @@ -221,7 +215,7 @@ static int a3000_bus_reset(Scsi_Cmnd *cmd) #define HOSTS_C -static Scsi_Host_Template driver_template = { +static struct scsi_host_template driver_template = { .proc_name = "A3000", .name = "Amiga 3000 built-in SCSI", .detect = a3000_detect, @@ -240,7 +234,7 @@ static Scsi_Host_Template driver_template = { #include "scsi_module.c" -int a3000_release(struct Scsi_Host *instance) +static int a3000_release(struct Scsi_Host *instance) { wd33c93_release(); DMA(instance)->CNTR = 0;