Loading drivers/scsi/a3000.c +28 −25 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,6 @@ #define DMA(ptr) ((a3000_scsiregs *)((ptr)->base)) #define DMA(ptr) ((a3000_scsiregs *)((ptr)->base)) #define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) static struct Scsi_Host *a3000_host = NULL; static struct Scsi_Host *a3000_host = NULL; Loading @@ -48,6 +47,7 @@ static irqreturn_t a3000_intr(int irq, void *dummy) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { { struct WD33C93_hostdata *hdata = shost_priv(a3000_host); unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); unsigned long addr = virt_to_bus(cmd->SCp.ptr); Loading @@ -58,24 +58,23 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) * buffer * buffer */ */ if (addr & A3000_XFER_MASK) { if (addr & A3000_XFER_MASK) { HDATA(a3000_host)->dma_bounce_len = hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; (cmd->SCp.this_residual + 511) & ~0x1ff; hdata->dma_bounce_buffer = kmalloc(hdata->dma_bounce_len, HDATA(a3000_host)->dma_bounce_buffer = GFP_KERNEL); kmalloc(HDATA(a3000_host)->dma_bounce_len, GFP_KERNEL); /* can't allocate memory; use PIO */ /* can't allocate memory; use PIO */ if (!HDATA(a3000_host)->dma_bounce_buffer) { if (!hdata->dma_bounce_buffer) { HDATA(a3000_host)->dma_bounce_len = 0; hdata->dma_bounce_len = 0; return 1; return 1; } } if (!dir_in) { if (!dir_in) { /* copy to bounce buffer for a write */ /* copy to bounce buffer for a write */ memcpy(HDATA(a3000_host)->dma_bounce_buffer, memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr, cmd->SCp.ptr, cmd->SCp.this_residual); cmd->SCp.this_residual); } } addr = virt_to_bus(HDATA(a3000_host)->dma_bounce_buffer); addr = virt_to_bus(hdata->dma_bounce_buffer); } } /* setup dma direction */ /* setup dma direction */ Loading @@ -83,7 +82,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cntr |= CNTR_DDIR; cntr |= CNTR_DDIR; /* remember direction */ /* remember direction */ HDATA(a3000_host)->dma_dir = dir_in; hdata->dma_dir = dir_in; DMA(a3000_host)->CNTR = cntr; DMA(a3000_host)->CNTR = cntr; Loading @@ -110,17 +109,19 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) int status) { { struct WD33C93_hostdata *hdata = shost_priv(instance); /* disable SCSI interrupts */ /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; unsigned short cntr = CNTR_PDMD; if (!HDATA(instance)->dma_dir) if (!hdata->dma_dir) cntr |= CNTR_DDIR; cntr |= CNTR_DDIR; DMA(instance)->CNTR = cntr; DMA(instance)->CNTR = cntr; mb(); /* make sure CNTR is updated before next IO */ mb(); /* make sure CNTR is updated before next IO */ /* flush if we were reading */ /* flush if we were reading */ if (HDATA(instance)->dma_dir) { if (hdata->dma_dir) { DMA(instance)->FLUSH = 1; DMA(instance)->FLUSH = 1; mb(); /* don't allow prefetch */ mb(); /* don't allow prefetch */ while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) Loading @@ -143,19 +144,19 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, mb(); /* make sure CNTR is updated before next IO */ mb(); /* make sure CNTR is updated before next IO */ /* copy from a bounce buffer, if necessary */ /* copy from a bounce buffer, if necessary */ if (status && HDATA(instance)->dma_bounce_buffer) { if (status && hdata->dma_bounce_buffer) { if (SCpnt) { if (SCpnt) { if (HDATA(instance)->dma_dir && SCpnt) if (hdata->dma_dir && SCpnt) memcpy(SCpnt->SCp.ptr, memcpy(SCpnt->SCp.ptr, HDATA(instance)->dma_bounce_buffer, hdata->dma_bounce_buffer, SCpnt->SCp.this_residual); SCpnt->SCp.this_residual); kfree(HDATA(instance)->dma_bounce_buffer); kfree(hdata->dma_bounce_buffer); HDATA(instance)->dma_bounce_buffer = NULL; hdata->dma_bounce_buffer = NULL; HDATA(instance)->dma_bounce_len = 0; hdata->dma_bounce_len = 0; } else { } else { kfree(HDATA(instance)->dma_bounce_buffer); kfree(hdata->dma_bounce_buffer); HDATA(instance)->dma_bounce_buffer = NULL; hdata->dma_bounce_buffer = NULL; HDATA(instance)->dma_bounce_len = 0; hdata->dma_bounce_len = 0; } } } } } } Loading @@ -163,6 +164,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, static int __init a3000_detect(struct scsi_host_template *tpnt) static int __init a3000_detect(struct scsi_host_template *tpnt) { { wd33c93_regs regs; wd33c93_regs regs; struct WD33C93_hostdata *hdata; if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) return 0; return 0; Loading @@ -181,9 +183,10 @@ static int __init a3000_detect(struct scsi_host_template *tpnt) DMA(a3000_host)->DAWR = DAWR_A3000; DMA(a3000_host)->DAWR = DAWR_A3000; regs.SASR = &(DMA(a3000_host)->SASR); regs.SASR = &(DMA(a3000_host)->SASR); regs.SCMD = &(DMA(a3000_host)->SCMD); regs.SCMD = &(DMA(a3000_host)->SCMD); HDATA(a3000_host)->no_sync = 0xff; hdata = shost_priv(a3000_host); HDATA(a3000_host)->fast = 0; hdata->no_sync = 0xff; HDATA(a3000_host)->dma_mode = CTRL_DMA; hdata->fast = 0; hdata->dma_mode = CTRL_DMA; wd33c93_init(a3000_host, regs, dma_setup, dma_stop, WD33C93_FS_12_15); 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", if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, "A3000 SCSI", a3000_intr)) a3000_intr)) Loading Loading
drivers/scsi/a3000.c +28 −25 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,6 @@ #define DMA(ptr) ((a3000_scsiregs *)((ptr)->base)) #define DMA(ptr) ((a3000_scsiregs *)((ptr)->base)) #define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) static struct Scsi_Host *a3000_host = NULL; static struct Scsi_Host *a3000_host = NULL; Loading @@ -48,6 +47,7 @@ static irqreturn_t a3000_intr(int irq, void *dummy) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { { struct WD33C93_hostdata *hdata = shost_priv(a3000_host); unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); unsigned long addr = virt_to_bus(cmd->SCp.ptr); Loading @@ -58,24 +58,23 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) * buffer * buffer */ */ if (addr & A3000_XFER_MASK) { if (addr & A3000_XFER_MASK) { HDATA(a3000_host)->dma_bounce_len = hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; (cmd->SCp.this_residual + 511) & ~0x1ff; hdata->dma_bounce_buffer = kmalloc(hdata->dma_bounce_len, HDATA(a3000_host)->dma_bounce_buffer = GFP_KERNEL); kmalloc(HDATA(a3000_host)->dma_bounce_len, GFP_KERNEL); /* can't allocate memory; use PIO */ /* can't allocate memory; use PIO */ if (!HDATA(a3000_host)->dma_bounce_buffer) { if (!hdata->dma_bounce_buffer) { HDATA(a3000_host)->dma_bounce_len = 0; hdata->dma_bounce_len = 0; return 1; return 1; } } if (!dir_in) { if (!dir_in) { /* copy to bounce buffer for a write */ /* copy to bounce buffer for a write */ memcpy(HDATA(a3000_host)->dma_bounce_buffer, memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr, cmd->SCp.ptr, cmd->SCp.this_residual); cmd->SCp.this_residual); } } addr = virt_to_bus(HDATA(a3000_host)->dma_bounce_buffer); addr = virt_to_bus(hdata->dma_bounce_buffer); } } /* setup dma direction */ /* setup dma direction */ Loading @@ -83,7 +82,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cntr |= CNTR_DDIR; cntr |= CNTR_DDIR; /* remember direction */ /* remember direction */ HDATA(a3000_host)->dma_dir = dir_in; hdata->dma_dir = dir_in; DMA(a3000_host)->CNTR = cntr; DMA(a3000_host)->CNTR = cntr; Loading @@ -110,17 +109,19 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) int status) { { struct WD33C93_hostdata *hdata = shost_priv(instance); /* disable SCSI interrupts */ /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; unsigned short cntr = CNTR_PDMD; if (!HDATA(instance)->dma_dir) if (!hdata->dma_dir) cntr |= CNTR_DDIR; cntr |= CNTR_DDIR; DMA(instance)->CNTR = cntr; DMA(instance)->CNTR = cntr; mb(); /* make sure CNTR is updated before next IO */ mb(); /* make sure CNTR is updated before next IO */ /* flush if we were reading */ /* flush if we were reading */ if (HDATA(instance)->dma_dir) { if (hdata->dma_dir) { DMA(instance)->FLUSH = 1; DMA(instance)->FLUSH = 1; mb(); /* don't allow prefetch */ mb(); /* don't allow prefetch */ while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) Loading @@ -143,19 +144,19 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, mb(); /* make sure CNTR is updated before next IO */ mb(); /* make sure CNTR is updated before next IO */ /* copy from a bounce buffer, if necessary */ /* copy from a bounce buffer, if necessary */ if (status && HDATA(instance)->dma_bounce_buffer) { if (status && hdata->dma_bounce_buffer) { if (SCpnt) { if (SCpnt) { if (HDATA(instance)->dma_dir && SCpnt) if (hdata->dma_dir && SCpnt) memcpy(SCpnt->SCp.ptr, memcpy(SCpnt->SCp.ptr, HDATA(instance)->dma_bounce_buffer, hdata->dma_bounce_buffer, SCpnt->SCp.this_residual); SCpnt->SCp.this_residual); kfree(HDATA(instance)->dma_bounce_buffer); kfree(hdata->dma_bounce_buffer); HDATA(instance)->dma_bounce_buffer = NULL; hdata->dma_bounce_buffer = NULL; HDATA(instance)->dma_bounce_len = 0; hdata->dma_bounce_len = 0; } else { } else { kfree(HDATA(instance)->dma_bounce_buffer); kfree(hdata->dma_bounce_buffer); HDATA(instance)->dma_bounce_buffer = NULL; hdata->dma_bounce_buffer = NULL; HDATA(instance)->dma_bounce_len = 0; hdata->dma_bounce_len = 0; } } } } } } Loading @@ -163,6 +164,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, static int __init a3000_detect(struct scsi_host_template *tpnt) static int __init a3000_detect(struct scsi_host_template *tpnt) { { wd33c93_regs regs; wd33c93_regs regs; struct WD33C93_hostdata *hdata; if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) return 0; return 0; Loading @@ -181,9 +183,10 @@ static int __init a3000_detect(struct scsi_host_template *tpnt) DMA(a3000_host)->DAWR = DAWR_A3000; DMA(a3000_host)->DAWR = DAWR_A3000; regs.SASR = &(DMA(a3000_host)->SASR); regs.SASR = &(DMA(a3000_host)->SASR); regs.SCMD = &(DMA(a3000_host)->SCMD); regs.SCMD = &(DMA(a3000_host)->SCMD); HDATA(a3000_host)->no_sync = 0xff; hdata = shost_priv(a3000_host); HDATA(a3000_host)->fast = 0; hdata->no_sync = 0xff; HDATA(a3000_host)->dma_mode = CTRL_DMA; hdata->fast = 0; hdata->dma_mode = CTRL_DMA; wd33c93_init(a3000_host, regs, dma_setup, dma_stop, WD33C93_FS_12_15); 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", if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, "A3000 SCSI", a3000_intr)) a3000_intr)) Loading