* [PATCH 0/21] m68k/scsi: wd33c93 driver cleanups
@ 2010-04-04 9:00 Geert Uytterhoeven
2010-04-04 9:00 ` [PATCH 01/21] scsi: wd33c93 - Kill empty wd33c93_release() Geert Uytterhoeven
0 siblings, 1 reply; 32+ messages in thread
From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw)
To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi
Hi all,
Here's a series of easter eggs for the m68k wd33c93 SCSI drivers:
- [01] scsi: wd33c93 - Kill empty wd33c93_release()
- [02] m68k/scsi: a2091 - Reindentation
- [03] m68k/scsi: gvp11 - Reindentation
- [04] m68k/scsi: mvme147 - Reindentation
- [05] m68k/scsi: a3000 - Reindentation
- [06] m68k/scsi: a2091 - Use shost_priv() and kill ugly HDATA() macro
- [07] m68k/scsi: gvp11 - Use shost_priv() and kill ugly HDATA() macro
- [08] m68k/scsi: mvme147 - Use shost_priv() and kill ugly HDATA() macro
- [09] m68k/scsi: a3000 - Use shost_priv() and kill ugly HDATA() macro
- [10] m68k/scsi: a2091 - Kill ugly DMA() macro
- [11] m68k/scsi: gvp11 - Kill ugly DMA() macro
- [12] m68k/scsi: a3000 - Kill ugly DMA() macro
- [13] m68k/scsi: mvme147 - Kill static global mvme147_host
- [14] m68k/scsi: a3000 - Kill static global a3000_host
- [15] m68k/scsi: gvp11 - Extract check_wd33c93()
- [16] m68k/scsi: a2091 - Kill a2091_scsiregs typedef
- [17] m68k/scsi: gvp11 - Kill gvp11_scsiregs typedef
- [18] m68k/scsi: a3000 - Kill a3000_scsiregs typedef
- [19] m68k/scsi: mvme147 - Kill obsolete HOSTS_C logic
- [20] m68k: amiga - A2091/A590 SCSI zorro_driver conversion
- [21] m68k: amiga - GVP Series II SCSI zorro_driver conversion
This series consists of 3 parts:
- Easter egg 01 is a trivial cleanup for the wd33c93 core,
- Easter eggs 02-19 do various cleanups for the m68k wd33c93 SCSI drivers,
- Easter eggs 20 and 21 convert the A2091/A590 and GVP Series II SCSI drivers
to proper new-style Zorro drivers.
drivers/scsi/a2091.c | 389 +++++++++++++++++---------------
drivers/scsi/a2091.h | 46 ++--
drivers/scsi/a3000.c | 301 +++++++++++++------------
drivers/scsi/a3000.h | 50 ++--
drivers/scsi/gvp11.c | 573 +++++++++++++++++++++++++-----------------------
drivers/scsi/gvp11.h | 49 ++---
drivers/scsi/mvme147.c | 178 ++++++++--------
drivers/scsi/mvme147.h | 4 +-
drivers/scsi/wd33c93.c | 6 -
drivers/scsi/wd33c93.h | 1 -
10 files changed, 820 insertions(+), 777 deletions(-)
Unfortunately I do not have the hardware, so none of this has been actually
tested. Especially easter eggs 20 and 21 are non-trivial and could use some
testing.
Question: If approved, should this go in through the SCSI tree, or can I take
it via the m68k tree?
I have another series of easter eggs to convert all drivers for built-in Amiga
hardware to proper platform drivers, but the A3000 SCSI part depends on this
series.
Thanks for your comments!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 32+ messages in thread* [PATCH 01/21] scsi: wd33c93 - Kill empty wd33c93_release() 2010-04-04 9:00 [PATCH 0/21] m68k/scsi: wd33c93 driver cleanups Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 02/21] m68k/scsi: a2091 - Reindentation Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley Cc: linux-m68k, linux-scsi, Geert Uytterhoeven, Ralf Baechle wd33c93_release() has been empty since ages, and sgiwd93.c no longer calls it since its conversion to a proper platform driver 2 years ago. Also remove the callers in the m68k wd33c93 shims. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Ralf Baechle <ralf@linux-mips.org> --- drivers/scsi/a2091.c | 2 -- drivers/scsi/a3000.c | 2 -- drivers/scsi/gvp11.c | 2 -- drivers/scsi/mvme147.c | 2 -- drivers/scsi/wd33c93.c | 6 ------ drivers/scsi/wd33c93.h | 1 - 6 files changed, 0 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index 4b38c47..f2731a7 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c @@ -192,7 +192,6 @@ static int __init a2091_detect(struct scsi_host_template *tpnt) unregister: scsi_unregister(instance); - wd33c93_release(); release: release_mem_region(address, 256); } @@ -241,7 +240,6 @@ static int a2091_release(struct Scsi_Host *instance) DMA(instance)->CNTR = 0; release_mem_region(ZTWO_PADDR(instance->base), 256); free_irq(IRQ_AMIGA_PORTS, instance); - wd33c93_release(); #endif return 1; } diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index 6970ce8..50b10df 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -192,7 +192,6 @@ static int __init a3000_detect(struct scsi_host_template *tpnt) return 1; fail_irq: - wd33c93_release(); scsi_unregister(a3000_host); fail_register: release_mem_region(0xDD0000, 256); @@ -236,7 +235,6 @@ static struct scsi_host_template driver_template = { static int a3000_release(struct Scsi_Host *instance) { - wd33c93_release(); DMA(instance)->CNTR = 0; release_mem_region(0xDD0000, 256); free_irq(IRQ_AMIGA_PORTS, a3000_intr); diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index 5d1bf7e..0b09c0d 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c @@ -338,7 +338,6 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) unregister: scsi_unregister(instance); - wd33c93_release(); release: release_mem_region(address, 256); } @@ -391,7 +390,6 @@ int gvp11_release(struct Scsi_Host *instance) DMA(instance)->CNTR = 0; release_mem_region(ZTWO_PADDR(instance->base), 256); free_irq(IRQ_AMIGA_PORTS, instance); - wd33c93_release(); #endif return 1; } diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index d722235..a423fcc 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c @@ -108,7 +108,6 @@ int mvme147_detect(struct scsi_host_template *tpnt) err_free_irq: free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr); err_unregister: - wd33c93_release(); scsi_unregister(mvme147_host); err_out: return 0; @@ -155,7 +154,6 @@ int mvme147_release(struct Scsi_Host *instance) { #ifdef MODULE /* XXX Make sure DMA is stopped! */ - wd33c93_release(); free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr); free_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr); #endif diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index 5fda881..b701bf2 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c @@ -2224,14 +2224,8 @@ wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off } -void -wd33c93_release(void) -{ -} - EXPORT_SYMBOL(wd33c93_host_reset); EXPORT_SYMBOL(wd33c93_init); -EXPORT_SYMBOL(wd33c93_release); EXPORT_SYMBOL(wd33c93_abort); EXPORT_SYMBOL(wd33c93_queuecommand); EXPORT_SYMBOL(wd33c93_intr); diff --git a/drivers/scsi/wd33c93.h b/drivers/scsi/wd33c93.h index 00123f2..1ed5f3b 100644 --- a/drivers/scsi/wd33c93.h +++ b/drivers/scsi/wd33c93.h @@ -348,6 +348,5 @@ int wd33c93_queuecommand (struct scsi_cmnd *cmd, void wd33c93_intr (struct Scsi_Host *instance); int wd33c93_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); int wd33c93_host_reset (struct scsi_cmnd *); -void wd33c93_release(void); #endif /* WD33C93_H */ -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 02/21] m68k/scsi: a2091 - Reindentation 2010-04-04 9:00 ` [PATCH 01/21] scsi: wd33c93 - Kill empty wd33c93_release() Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 03/21] m68k/scsi: gvp11 " Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a2091.c | 299 +++++++++++++++++++++++++------------------------- drivers/scsi/a2091.h | 42 ++++---- 2 files changed, 171 insertions(+), 170 deletions(-) diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index f2731a7..f09c8ba 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c @@ -18,185 +18,186 @@ #include "wd33c93.h" #include "a2091.h" -#include<linux/stat.h> +#include <linux/stat.h> -#define DMA(ptr) ((a2091_scsiregs *)((ptr)->base)) -#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) + +#define DMA(ptr) ((a2091_scsiregs *)((ptr)->base)) +#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) static int a2091_release(struct Scsi_Host *instance); -static irqreturn_t a2091_intr (int irq, void *_instance) +static irqreturn_t a2091_intr(int irq, void *_instance) { - unsigned long flags; - unsigned int status; - struct Scsi_Host *instance = (struct Scsi_Host *)_instance; - - status = DMA(instance)->ISTR; - if (!(status & (ISTR_INT_F|ISTR_INT_P)) || !(status & ISTR_INTS)) - return IRQ_NONE; - - spin_lock_irqsave(instance->host_lock, flags); - wd33c93_intr(instance); - spin_unlock_irqrestore(instance->host_lock, flags); - return IRQ_HANDLED; + unsigned long flags; + unsigned int status; + struct Scsi_Host *instance = (struct Scsi_Host *)_instance; + + status = DMA(instance)->ISTR; + if (!(status & (ISTR_INT_F | ISTR_INT_P)) || !(status & ISTR_INTS)) + return IRQ_NONE; + + spin_lock_irqsave(instance->host_lock, flags); + wd33c93_intr(instance); + spin_unlock_irqrestore(instance->host_lock, flags); + return IRQ_HANDLED; } 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) - { - HDATA(instance)->dma_bounce_len = (cmd->SCp.this_residual + 511) - & ~0x1ff; - HDATA(instance)->dma_bounce_buffer = - kmalloc (HDATA(instance)->dma_bounce_len, GFP_KERNEL); - - /* can't allocate memory; use PIO */ - if (!HDATA(instance)->dma_bounce_buffer) { - HDATA(instance)->dma_bounce_len = 0; - return 1; - } - - /* get the physical address of the bounce buffer */ - addr = virt_to_bus(HDATA(instance)->dma_bounce_buffer); + unsigned short cntr = CNTR_PDMD | CNTR_INTEN; + unsigned long addr = virt_to_bus(cmd->SCp.ptr); + struct Scsi_Host *instance = cmd->device->host; - /* the bounce buffer may not be in the first 16M of physmem */ + /* don't allow DMA if the physical address is bad */ if (addr & A2091_XFER_MASK) { - /* we could use chipmem... maybe later */ - kfree (HDATA(instance)->dma_bounce_buffer); - HDATA(instance)->dma_bounce_buffer = NULL; - HDATA(instance)->dma_bounce_len = 0; - return 1; - } - - if (!dir_in) { - /* copy to bounce buffer for a write */ - memcpy (HDATA(instance)->dma_bounce_buffer, - cmd->SCp.ptr, cmd->SCp.this_residual); + HDATA(instance)->dma_bounce_len = + (cmd->SCp.this_residual + 511) & ~0x1ff; + HDATA(instance)->dma_bounce_buffer = + kmalloc(HDATA(instance)->dma_bounce_len, GFP_KERNEL); + + /* can't allocate memory; use PIO */ + if (!HDATA(instance)->dma_bounce_buffer) { + HDATA(instance)->dma_bounce_len = 0; + return 1; + } + + /* get the physical address of the bounce buffer */ + addr = virt_to_bus(HDATA(instance)->dma_bounce_buffer); + + /* the bounce buffer may not be in the first 16M of physmem */ + if (addr & A2091_XFER_MASK) { + /* we could use chipmem... maybe later */ + kfree(HDATA(instance)->dma_bounce_buffer); + HDATA(instance)->dma_bounce_buffer = NULL; + HDATA(instance)->dma_bounce_len = 0; + return 1; + } + + if (!dir_in) { + /* copy to bounce buffer for a write */ + memcpy(HDATA(instance)->dma_bounce_buffer, + cmd->SCp.ptr, cmd->SCp.this_residual); + } } - } - /* setup dma direction */ - if (!dir_in) - cntr |= CNTR_DDIR; + /* setup dma direction */ + if (!dir_in) + cntr |= CNTR_DDIR; - /* remember direction */ - HDATA(cmd->device->host)->dma_dir = dir_in; + /* remember direction */ + HDATA(cmd->device->host)->dma_dir = dir_in; - DMA(cmd->device->host)->CNTR = cntr; + DMA(cmd->device->host)->CNTR = cntr; - /* setup DMA *physical* address */ - DMA(cmd->device->host)->ACR = addr; + /* setup DMA *physical* address */ + DMA(cmd->device->host)->ACR = addr; - if (dir_in){ - /* invalidate any cache */ - cache_clear (addr, cmd->SCp.this_residual); - }else{ - /* push any dirty cache */ - cache_push (addr, cmd->SCp.this_residual); - } - /* start DMA */ - DMA(cmd->device->host)->ST_DMA = 1; + if (dir_in) { + /* invalidate any cache */ + cache_clear(addr, cmd->SCp.this_residual); + } else { + /* push any dirty cache */ + cache_push(addr, cmd->SCp.this_residual); + } + /* start DMA */ + DMA(cmd->device->host)->ST_DMA = 1; - /* return success */ - return 0; + /* return success */ + return 0; } static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, - int status) + int status) { - /* disable SCSI interrupts */ - unsigned short cntr = CNTR_PDMD; - - if (!HDATA(instance)->dma_dir) - cntr |= CNTR_DDIR; - - /* disable SCSI interrupts */ - DMA(instance)->CNTR = cntr; - - /* flush if we were reading */ - if (HDATA(instance)->dma_dir) { - DMA(instance)->FLUSH = 1; - while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) - ; - } - - /* clear a possible interrupt */ - DMA(instance)->CINT = 1; - - /* stop DMA */ - DMA(instance)->SP_DMA = 1; - - /* restore the CONTROL bits (minus the direction flag) */ - DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; - - /* copy from a bounce buffer, if necessary */ - if (status && HDATA(instance)->dma_bounce_buffer) { - 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; - } + /* disable SCSI interrupts */ + unsigned short cntr = CNTR_PDMD; + + if (!HDATA(instance)->dma_dir) + cntr |= CNTR_DDIR; + + /* disable SCSI interrupts */ + DMA(instance)->CNTR = cntr; + + /* flush if we were reading */ + if (HDATA(instance)->dma_dir) { + DMA(instance)->FLUSH = 1; + while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) + ; + } + + /* clear a possible interrupt */ + DMA(instance)->CINT = 1; + + /* stop DMA */ + DMA(instance)->SP_DMA = 1; + + /* restore the CONTROL bits (minus the direction flag) */ + DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; + + /* copy from a bounce buffer, if necessary */ + if (status && HDATA(instance)->dma_bounce_buffer) { + 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; + } } static int __init a2091_detect(struct scsi_host_template *tpnt) { - static unsigned char called = 0; - struct Scsi_Host *instance; - unsigned long address; - struct zorro_dev *z = NULL; - wd33c93_regs regs; - int num_a2091 = 0; - - if (!MACH_IS_AMIGA || called) - return 0; - called = 1; - - tpnt->proc_name = "A2091"; - tpnt->proc_info = &wd33c93_proc_info; - - while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { - if (z->id != ZORRO_PROD_CBM_A590_A2091_1 && - z->id != ZORRO_PROD_CBM_A590_A2091_2) - continue; - address = z->resource.start; - if (!request_mem_region(address, 256, "wd33c93")) - continue; - - instance = scsi_register (tpnt, sizeof (struct WD33C93_hostdata)); - if (instance == NULL) - goto release; - instance->base = ZTWO_VADDR(address); - instance->irq = IRQ_AMIGA_PORTS; - instance->unique_id = z->slotaddr; - DMA(instance)->DAWR = DAWR_A2091; - regs.SASR = &(DMA(instance)->SASR); - regs.SCMD = &(DMA(instance)->SCMD); - HDATA(instance)->no_sync = 0xff; - HDATA(instance)->fast = 0; - HDATA(instance)->dma_mode = CTRL_DMA; - wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10); - if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, "A2091 SCSI", - instance)) - goto unregister; - DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; - num_a2091++; - continue; + static unsigned char called = 0; + struct Scsi_Host *instance; + unsigned long address; + struct zorro_dev *z = NULL; + wd33c93_regs regs; + int num_a2091 = 0; + + if (!MACH_IS_AMIGA || called) + return 0; + called = 1; + + tpnt->proc_name = "A2091"; + tpnt->proc_info = &wd33c93_proc_info; + + while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { + if (z->id != ZORRO_PROD_CBM_A590_A2091_1 && + z->id != ZORRO_PROD_CBM_A590_A2091_2) + continue; + address = z->resource.start; + if (!request_mem_region(address, 256, "wd33c93")) + continue; + + instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); + if (instance == NULL) + goto release; + instance->base = ZTWO_VADDR(address); + instance->irq = IRQ_AMIGA_PORTS; + instance->unique_id = z->slotaddr; + DMA(instance)->DAWR = DAWR_A2091; + regs.SASR = &(DMA(instance)->SASR); + regs.SCMD = &(DMA(instance)->SCMD); + HDATA(instance)->no_sync = 0xff; + HDATA(instance)->fast = 0; + HDATA(instance)->dma_mode = CTRL_DMA; + wd33c93_init(instance, regs, dma_setup, dma_stop, + WD33C93_FS_8_10); + if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, + "A2091 SCSI", instance)) + goto unregister; + DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; + num_a2091++; + continue; unregister: - scsi_unregister(instance); + scsi_unregister(instance); release: - release_mem_region(address, 256); - } + release_mem_region(address, 256); + } - return num_a2091; + return num_a2091; } static int a2091_bus_reset(struct scsi_cmnd *cmd) diff --git a/drivers/scsi/a2091.h b/drivers/scsi/a2091.h index 252528f..1c3daa1 100644 --- a/drivers/scsi/a2091.h +++ b/drivers/scsi/a2091.h @@ -12,38 +12,38 @@ #include <linux/types.h> #ifndef CMD_PER_LUN -#define CMD_PER_LUN 2 +#define CMD_PER_LUN 2 #endif #ifndef CAN_QUEUE -#define CAN_QUEUE 16 +#define CAN_QUEUE 16 #endif /* * if the transfer address ANDed with this results in a non-zero * result, then we can't use DMA. */ -#define A2091_XFER_MASK (0xff000001) +#define A2091_XFER_MASK (0xff000001) typedef struct { - unsigned char pad1[64]; - volatile unsigned short ISTR; - volatile unsigned short CNTR; - unsigned char pad2[60]; - volatile unsigned int WTC; - volatile unsigned long ACR; - unsigned char pad3[6]; - volatile unsigned short DAWR; - unsigned char pad4; - volatile unsigned char SASR; - unsigned char pad5; - volatile unsigned char SCMD; - unsigned char pad6[76]; - volatile unsigned short ST_DMA; - volatile unsigned short SP_DMA; - volatile unsigned short CINT; - unsigned char pad7[2]; - volatile unsigned short FLUSH; + unsigned char pad1[64]; + volatile unsigned short ISTR; + volatile unsigned short CNTR; + unsigned char pad2[60]; + volatile unsigned int WTC; + volatile unsigned long ACR; + unsigned char pad3[6]; + volatile unsigned short DAWR; + unsigned char pad4; + volatile unsigned char SASR; + unsigned char pad5; + volatile unsigned char SCMD; + unsigned char pad6[76]; + volatile unsigned short ST_DMA; + volatile unsigned short SP_DMA; + volatile unsigned short CINT; + unsigned char pad7[2]; + volatile unsigned short FLUSH; } a2091_scsiregs; #define DAWR_A2091 (3) -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 03/21] m68k/scsi: gvp11 - Reindentation 2010-04-04 9:00 ` [PATCH 02/21] m68k/scsi: a2091 - Reindentation Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 04/21] m68k/scsi: mvme147 " Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/gvp11.c | 562 +++++++++++++++++++++++++------------------------- drivers/scsi/gvp11.h | 36 ++-- 2 files changed, 301 insertions(+), 297 deletions(-) diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index 0b09c0d..6ec7520 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c @@ -18,331 +18,335 @@ #include "wd33c93.h" #include "gvp11.h" -#include<linux/stat.h> +#include <linux/stat.h> -#define DMA(ptr) ((gvp11_scsiregs *)((ptr)->base)) -#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) -static irqreturn_t gvp11_intr (int irq, void *_instance) +#define DMA(ptr) ((gvp11_scsiregs *)((ptr)->base)) +#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) + +static irqreturn_t gvp11_intr(int irq, void *_instance) { - unsigned long flags; - unsigned int status; - struct Scsi_Host *instance = (struct Scsi_Host *)_instance; - - status = DMA(instance)->CNTR; - if (!(status & GVP11_DMAC_INT_PENDING)) - return IRQ_NONE; - - spin_lock_irqsave(instance->host_lock, flags); - wd33c93_intr(instance); - spin_unlock_irqrestore(instance->host_lock, flags); - return IRQ_HANDLED; + unsigned long flags; + unsigned int status; + struct Scsi_Host *instance = (struct Scsi_Host *)_instance; + + status = DMA(instance)->CNTR; + if (!(status & GVP11_DMAC_INT_PENDING)) + return IRQ_NONE; + + spin_lock_irqsave(instance->host_lock, flags); + wd33c93_intr(instance); + spin_unlock_irqrestore(instance->host_lock, flags); + return IRQ_HANDLED; } static int gvp11_xfer_mask = 0; -void gvp11_setup (char *str, int *ints) +void gvp11_setup(char *str, int *ints) { - gvp11_xfer_mask = ints[1]; + gvp11_xfer_mask = ints[1]; } static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { - unsigned short cntr = GVP11_DMAC_INT_ENABLE; - unsigned long addr = virt_to_bus(cmd->SCp.ptr); - int bank_mask; - static int scsi_alloc_out_of_range = 0; - - /* use bounce buffer if the physical address is bad */ - if (addr & HDATA(cmd->device->host)->dma_xfer_mask) - { - HDATA(cmd->device->host)->dma_bounce_len = (cmd->SCp.this_residual + 511) - & ~0x1ff; - - if( !scsi_alloc_out_of_range ) { - HDATA(cmd->device->host)->dma_bounce_buffer = - kmalloc (HDATA(cmd->device->host)->dma_bounce_len, GFP_KERNEL); - HDATA(cmd->device->host)->dma_buffer_pool = BUF_SCSI_ALLOCED; - } + unsigned short cntr = GVP11_DMAC_INT_ENABLE; + unsigned long addr = virt_to_bus(cmd->SCp.ptr); + int bank_mask; + static int scsi_alloc_out_of_range = 0; - if (scsi_alloc_out_of_range || - !HDATA(cmd->device->host)->dma_bounce_buffer) { - HDATA(cmd->device->host)->dma_bounce_buffer = - amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len, - "GVP II SCSI Bounce Buffer"); + /* use bounce buffer if the physical address is bad */ + if (addr & HDATA(cmd->device->host)->dma_xfer_mask) { + HDATA(cmd->device->host)->dma_bounce_len = + (cmd->SCp.this_residual + 511) & ~0x1ff; + + if (!scsi_alloc_out_of_range) { + HDATA(cmd->device->host)->dma_bounce_buffer = + kmalloc(HDATA(cmd->device->host)->dma_bounce_len, + GFP_KERNEL); + HDATA(cmd->device->host)->dma_buffer_pool = + BUF_SCSI_ALLOCED; + } - if(!HDATA(cmd->device->host)->dma_bounce_buffer) - { - HDATA(cmd->device->host)->dma_bounce_len = 0; - return 1; - } + if (scsi_alloc_out_of_range || + !HDATA(cmd->device->host)->dma_bounce_buffer) { + HDATA(cmd->device->host)->dma_bounce_buffer = + amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len, + "GVP II SCSI Bounce Buffer"); - HDATA(cmd->device->host)->dma_buffer_pool = BUF_CHIP_ALLOCED; - } + if (!HDATA(cmd->device->host)->dma_bounce_buffer) { + HDATA(cmd->device->host)->dma_bounce_len = 0; + return 1; + } - /* check if the address of the bounce buffer is OK */ - addr = virt_to_bus(HDATA(cmd->device->host)->dma_bounce_buffer); + HDATA(cmd->device->host)->dma_buffer_pool = + BUF_CHIP_ALLOCED; + } - if (addr & HDATA(cmd->device->host)->dma_xfer_mask) { - /* fall back to Chip RAM if address out of range */ - if( HDATA(cmd->device->host)->dma_buffer_pool == BUF_SCSI_ALLOCED) { - kfree (HDATA(cmd->device->host)->dma_bounce_buffer); - scsi_alloc_out_of_range = 1; - } else { - amiga_chip_free (HDATA(cmd->device->host)->dma_bounce_buffer); - } - - HDATA(cmd->device->host)->dma_bounce_buffer = - amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len, - "GVP II SCSI Bounce Buffer"); - - if(!HDATA(cmd->device->host)->dma_bounce_buffer) - { - HDATA(cmd->device->host)->dma_bounce_len = 0; - return 1; - } - - addr = virt_to_bus(HDATA(cmd->device->host)->dma_bounce_buffer); - HDATA(cmd->device->host)->dma_buffer_pool = BUF_CHIP_ALLOCED; - } - - if (!dir_in) { - /* copy to bounce buffer for a write */ - memcpy (HDATA(cmd->device->host)->dma_bounce_buffer, - cmd->SCp.ptr, cmd->SCp.this_residual); + /* check if the address of the bounce buffer is OK */ + addr = virt_to_bus(HDATA(cmd->device->host)->dma_bounce_buffer); + + if (addr & HDATA(cmd->device->host)->dma_xfer_mask) { + /* fall back to Chip RAM if address out of range */ + if (HDATA(cmd->device->host)->dma_buffer_pool == + BUF_SCSI_ALLOCED) { + kfree(HDATA(cmd->device->host)->dma_bounce_buffer); + scsi_alloc_out_of_range = 1; + } else { + amiga_chip_free(HDATA(cmd->device->host)->dma_bounce_buffer); + } + + HDATA(cmd->device->host)->dma_bounce_buffer = + amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len, + "GVP II SCSI Bounce Buffer"); + + if (!HDATA(cmd->device->host)->dma_bounce_buffer) { + HDATA(cmd->device->host)->dma_bounce_len = 0; + return 1; + } + + addr = virt_to_bus(HDATA(cmd->device->host)->dma_bounce_buffer); + HDATA(cmd->device->host)->dma_buffer_pool = + BUF_CHIP_ALLOCED; + } + + if (!dir_in) { + /* copy to bounce buffer for a write */ + memcpy(HDATA(cmd->device->host)->dma_bounce_buffer, + cmd->SCp.ptr, cmd->SCp.this_residual); + } } - } - /* setup dma direction */ - if (!dir_in) - cntr |= GVP11_DMAC_DIR_WRITE; + /* setup dma direction */ + if (!dir_in) + cntr |= GVP11_DMAC_DIR_WRITE; - HDATA(cmd->device->host)->dma_dir = dir_in; - DMA(cmd->device->host)->CNTR = cntr; + HDATA(cmd->device->host)->dma_dir = dir_in; + DMA(cmd->device->host)->CNTR = cntr; - /* setup DMA *physical* address */ - DMA(cmd->device->host)->ACR = addr; + /* setup DMA *physical* address */ + DMA(cmd->device->host)->ACR = addr; - if (dir_in) - /* invalidate any cache */ - cache_clear (addr, cmd->SCp.this_residual); - else - /* push any dirty cache */ - cache_push (addr, cmd->SCp.this_residual); + if (dir_in) { + /* invalidate any cache */ + cache_clear(addr, cmd->SCp.this_residual); + } else { + /* push any dirty cache */ + cache_push(addr, cmd->SCp.this_residual); + } - if ((bank_mask = (~HDATA(cmd->device->host)->dma_xfer_mask >> 18) & 0x01c0)) - DMA(cmd->device->host)->BANK = bank_mask & (addr >> 18); + if ((bank_mask = (~HDATA(cmd->device->host)->dma_xfer_mask >> 18) & 0x01c0)) + DMA(cmd->device->host)->BANK = bank_mask & (addr >> 18); - /* start DMA */ - DMA(cmd->device->host)->ST_DMA = 1; + /* start DMA */ + DMA(cmd->device->host)->ST_DMA = 1; - /* return success */ - return 0; + /* return success */ + return 0; } static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { - /* stop DMA */ - DMA(instance)->SP_DMA = 1; - /* remove write bit from CONTROL bits */ - DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; - - /* copy from a bounce buffer, if necessary */ - if (status && HDATA(instance)->dma_bounce_buffer) { - if (HDATA(instance)->dma_dir && SCpnt) - memcpy (SCpnt->SCp.ptr, - HDATA(instance)->dma_bounce_buffer, - SCpnt->SCp.this_residual); - - if (HDATA(instance)->dma_buffer_pool == BUF_SCSI_ALLOCED) - kfree (HDATA(instance)->dma_bounce_buffer); - else - amiga_chip_free(HDATA(instance)->dma_bounce_buffer); - - HDATA(instance)->dma_bounce_buffer = NULL; - HDATA(instance)->dma_bounce_len = 0; - } + /* stop DMA */ + DMA(instance)->SP_DMA = 1; + /* remove write bit from CONTROL bits */ + DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; + + /* copy from a bounce buffer, if necessary */ + if (status && HDATA(instance)->dma_bounce_buffer) { + if (HDATA(instance)->dma_dir && SCpnt) + memcpy(SCpnt->SCp.ptr, + HDATA(instance)->dma_bounce_buffer, + SCpnt->SCp.this_residual); + + if (HDATA(instance)->dma_buffer_pool == BUF_SCSI_ALLOCED) + kfree(HDATA(instance)->dma_bounce_buffer); + else + amiga_chip_free(HDATA(instance)->dma_bounce_buffer); + + HDATA(instance)->dma_bounce_buffer = NULL; + HDATA(instance)->dma_bounce_len = 0; + } } #define CHECK_WD33C93 int __init gvp11_detect(struct scsi_host_template *tpnt) { - static unsigned char called = 0; - struct Scsi_Host *instance; - unsigned long address; - unsigned int epc; - struct zorro_dev *z = NULL; - unsigned int default_dma_xfer_mask; - wd33c93_regs regs; - int num_gvp11 = 0; + static unsigned char called = 0; + struct Scsi_Host *instance; + unsigned long address; + unsigned int epc; + struct zorro_dev *z = NULL; + unsigned int default_dma_xfer_mask; + wd33c93_regs regs; + int num_gvp11 = 0; #ifdef CHECK_WD33C93 - volatile unsigned char *sasr_3393, *scmd_3393; - unsigned char save_sasr; - unsigned char q, qq; + volatile unsigned char *sasr_3393, *scmd_3393; + unsigned char save_sasr; + unsigned char q, qq; #endif - if (!MACH_IS_AMIGA || called) - return 0; - called = 1; - - tpnt->proc_name = "GVP11"; - tpnt->proc_info = &wd33c93_proc_info; - - while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { - /* - * This should (hopefully) be the correct way to identify - * all the different GVP SCSI controllers (except for the - * SERIES I though). - */ - - if (z->id == ZORRO_PROD_GVP_COMBO_030_R3_SCSI || - z->id == ZORRO_PROD_GVP_SERIES_II) - default_dma_xfer_mask = ~0x00ffffff; - else if (z->id == ZORRO_PROD_GVP_GFORCE_030_SCSI || - z->id == ZORRO_PROD_GVP_A530_SCSI || - z->id == ZORRO_PROD_GVP_COMBO_030_R4_SCSI) - default_dma_xfer_mask = ~0x01ffffff; - else if (z->id == ZORRO_PROD_GVP_A1291 || - z->id == ZORRO_PROD_GVP_GFORCE_040_SCSI_1) - default_dma_xfer_mask = ~0x07ffffff; - else - continue; - - /* - * Rumors state that some GVP ram boards use the same product - * code as the SCSI controllers. Therefore if the board-size - * is not 64KB we asume it is a ram board and bail out. - */ - if (z->resource.end-z->resource.start != 0xffff) - continue; - - address = z->resource.start; - if (!request_mem_region(address, 256, "wd33c93")) - continue; + if (!MACH_IS_AMIGA || called) + return 0; + called = 1; + + tpnt->proc_name = "GVP11"; + tpnt->proc_info = &wd33c93_proc_info; + + while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { + /* + * This should (hopefully) be the correct way to identify + * all the different GVP SCSI controllers (except for the + * SERIES I though). + */ + + if (z->id == ZORRO_PROD_GVP_COMBO_030_R3_SCSI || + z->id == ZORRO_PROD_GVP_SERIES_II) + default_dma_xfer_mask = ~0x00ffffff; + else if (z->id == ZORRO_PROD_GVP_GFORCE_030_SCSI || + z->id == ZORRO_PROD_GVP_A530_SCSI || + z->id == ZORRO_PROD_GVP_COMBO_030_R4_SCSI) + default_dma_xfer_mask = ~0x01ffffff; + else if (z->id == ZORRO_PROD_GVP_A1291 || + z->id == ZORRO_PROD_GVP_GFORCE_040_SCSI_1) + default_dma_xfer_mask = ~0x07ffffff; + else + continue; + + /* + * Rumors state that some GVP ram boards use the same product + * code as the SCSI controllers. Therefore if the board-size + * is not 64KB we asume it is a ram board and bail out. + */ + if (z->resource.end - z->resource.start != 0xffff) + continue; + + address = z->resource.start; + if (!request_mem_region(address, 256, "wd33c93")) + continue; #ifdef CHECK_WD33C93 - /* - * These darn GVP boards are a problem - it can be tough to tell - * whether or not they include a SCSI controller. This is the - * ultimate Yet-Another-GVP-Detection-Hack in that it actually - * probes for a WD33c93 chip: If we find one, it's extremely - * likely that this card supports SCSI, regardless of Product_ - * Code, Board_Size, etc. - */ - - /* Get pointers to the presumed register locations and save contents */ - - sasr_3393 = &(((gvp11_scsiregs *)(ZTWO_VADDR(address)))->SASR); - scmd_3393 = &(((gvp11_scsiregs *)(ZTWO_VADDR(address)))->SCMD); - save_sasr = *sasr_3393; - - /* First test the AuxStatus Reg */ - - q = *sasr_3393; /* read it */ - if (q & 0x08) /* bit 3 should always be clear */ - goto release; - *sasr_3393 = WD_AUXILIARY_STATUS; /* setup indirect address */ - if (*sasr_3393 == WD_AUXILIARY_STATUS) { /* shouldn't retain the write */ - *sasr_3393 = save_sasr; /* Oops - restore this byte */ - goto release; + /* + * These darn GVP boards are a problem - it can be tough to tell + * whether or not they include a SCSI controller. This is the + * ultimate Yet-Another-GVP-Detection-Hack in that it actually + * probes for a WD33c93 chip: If we find one, it's extremely + * likely that this card supports SCSI, regardless of Product_ + * Code, Board_Size, etc. + */ + + /* Get pointers to the presumed register locations and save contents */ + + sasr_3393 = &(((gvp11_scsiregs *)(ZTWO_VADDR(address)))->SASR); + scmd_3393 = &(((gvp11_scsiregs *)(ZTWO_VADDR(address)))->SCMD); + save_sasr = *sasr_3393; + + /* First test the AuxStatus Reg */ + + q = *sasr_3393; /* read it */ + if (q & 0x08) /* bit 3 should always be clear */ + goto release; + *sasr_3393 = WD_AUXILIARY_STATUS; /* setup indirect address */ + if (*sasr_3393 == WD_AUXILIARY_STATUS) { /* shouldn't retain the write */ + *sasr_3393 = save_sasr; /* Oops - restore this byte */ + goto release; } - if (*sasr_3393 != q) { /* should still read the same */ - *sasr_3393 = save_sasr; /* Oops - restore this byte */ - goto release; + if (*sasr_3393 != q) { /* should still read the same */ + *sasr_3393 = save_sasr; /* Oops - restore this byte */ + goto release; } - if (*scmd_3393 != q) /* and so should the image at 0x1f */ - goto release; - - - /* Ok, we probably have a wd33c93, but let's check a few other places - * for good measure. Make sure that this works for both 'A and 'B - * chip versions. - */ - - *sasr_3393 = WD_SCSI_STATUS; - q = *scmd_3393; - *sasr_3393 = WD_SCSI_STATUS; - *scmd_3393 = ~q; - *sasr_3393 = WD_SCSI_STATUS; - qq = *scmd_3393; - *sasr_3393 = WD_SCSI_STATUS; - *scmd_3393 = q; - if (qq != q) /* should be read only */ - goto release; - *sasr_3393 = 0x1e; /* this register is unimplemented */ - q = *scmd_3393; - *sasr_3393 = 0x1e; - *scmd_3393 = ~q; - *sasr_3393 = 0x1e; - qq = *scmd_3393; - *sasr_3393 = 0x1e; - *scmd_3393 = q; - if (qq != q || qq != 0xff) /* should be read only, all 1's */ - goto release; - *sasr_3393 = WD_TIMEOUT_PERIOD; - q = *scmd_3393; - *sasr_3393 = WD_TIMEOUT_PERIOD; - *scmd_3393 = ~q; - *sasr_3393 = WD_TIMEOUT_PERIOD; - qq = *scmd_3393; - *sasr_3393 = WD_TIMEOUT_PERIOD; - *scmd_3393 = q; - if (qq != (~q & 0xff)) /* should be read/write */ - goto release; + if (*scmd_3393 != q) /* and so should the image at 0x1f */ + goto release; + + /* + * Ok, we probably have a wd33c93, but let's check a few other places + * for good measure. Make sure that this works for both 'A and 'B + * chip versions. + */ + + *sasr_3393 = WD_SCSI_STATUS; + q = *scmd_3393; + *sasr_3393 = WD_SCSI_STATUS; + *scmd_3393 = ~q; + *sasr_3393 = WD_SCSI_STATUS; + qq = *scmd_3393; + *sasr_3393 = WD_SCSI_STATUS; + *scmd_3393 = q; + if (qq != q) /* should be read only */ + goto release; + *sasr_3393 = 0x1e; /* this register is unimplemented */ + q = *scmd_3393; + *sasr_3393 = 0x1e; + *scmd_3393 = ~q; + *sasr_3393 = 0x1e; + qq = *scmd_3393; + *sasr_3393 = 0x1e; + *scmd_3393 = q; + if (qq != q || qq != 0xff) /* should be read only, all 1's */ + goto release; + *sasr_3393 = WD_TIMEOUT_PERIOD; + q = *scmd_3393; + *sasr_3393 = WD_TIMEOUT_PERIOD; + *scmd_3393 = ~q; + *sasr_3393 = WD_TIMEOUT_PERIOD; + qq = *scmd_3393; + *sasr_3393 = WD_TIMEOUT_PERIOD; + *scmd_3393 = q; + if (qq != (~q & 0xff)) /* should be read/write */ + goto release; #endif - instance = scsi_register (tpnt, sizeof (struct WD33C93_hostdata)); - if(instance == NULL) - goto release; - instance->base = ZTWO_VADDR(address); - instance->irq = IRQ_AMIGA_PORTS; - instance->unique_id = z->slotaddr; - - if (gvp11_xfer_mask) - HDATA(instance)->dma_xfer_mask = gvp11_xfer_mask; - else - HDATA(instance)->dma_xfer_mask = default_dma_xfer_mask; - - - DMA(instance)->secret2 = 1; - DMA(instance)->secret1 = 0; - DMA(instance)->secret3 = 15; - while (DMA(instance)->CNTR & GVP11_DMAC_BUSY) ; - DMA(instance)->CNTR = 0; - - DMA(instance)->BANK = 0; - - epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000); - - /* - * Check for 14MHz SCSI clock - */ - regs.SASR = &(DMA(instance)->SASR); - regs.SCMD = &(DMA(instance)->SCMD); - HDATA(instance)->no_sync = 0xff; - HDATA(instance)->fast = 0; - HDATA(instance)->dma_mode = CTRL_DMA; - wd33c93_init(instance, regs, dma_setup, dma_stop, - (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 - : WD33C93_FS_12_15); - - if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, "GVP11 SCSI", - instance)) - goto unregister; - DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; - num_gvp11++; - continue; + instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); + if (instance == NULL) + goto release; + instance->base = ZTWO_VADDR(address); + instance->irq = IRQ_AMIGA_PORTS; + instance->unique_id = z->slotaddr; + + if (gvp11_xfer_mask) + HDATA(instance)->dma_xfer_mask = gvp11_xfer_mask; + else + HDATA(instance)->dma_xfer_mask = default_dma_xfer_mask; + + DMA(instance)->secret2 = 1; + DMA(instance)->secret1 = 0; + DMA(instance)->secret3 = 15; + while (DMA(instance)->CNTR & GVP11_DMAC_BUSY) + ; + DMA(instance)->CNTR = 0; + + DMA(instance)->BANK = 0; + + epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000); + + /* + * Check for 14MHz SCSI clock + */ + regs.SASR = &(DMA(instance)->SASR); + regs.SCMD = &(DMA(instance)->SCMD); + HDATA(instance)->no_sync = 0xff; + HDATA(instance)->fast = 0; + HDATA(instance)->dma_mode = CTRL_DMA; + wd33c93_init(instance, regs, dma_setup, dma_stop, + (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 + : WD33C93_FS_12_15); + + if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, + "GVP11 SCSI", instance)) + goto unregister; + DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; + num_gvp11++; + continue; unregister: - scsi_unregister(instance); + scsi_unregister(instance); release: - release_mem_region(address, 256); - } + release_mem_region(address, 256); + } - return num_gvp11; + return num_gvp11; } static int gvp11_bus_reset(struct scsi_cmnd *cmd) @@ -387,11 +391,11 @@ static struct scsi_host_template driver_template = { int gvp11_release(struct Scsi_Host *instance) { #ifdef MODULE - DMA(instance)->CNTR = 0; - release_mem_region(ZTWO_PADDR(instance->base), 256); - free_irq(IRQ_AMIGA_PORTS, instance); + DMA(instance)->CNTR = 0; + release_mem_region(ZTWO_PADDR(instance->base), 256); + free_irq(IRQ_AMIGA_PORTS, instance); #endif - return 1; + return 1; } MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/gvp11.h b/drivers/scsi/gvp11.h index bf22859..e2efdf9 100644 --- a/drivers/scsi/gvp11.h +++ b/drivers/scsi/gvp11.h @@ -15,11 +15,11 @@ int gvp11_detect(struct scsi_host_template *); int gvp11_release(struct Scsi_Host *); #ifndef CMD_PER_LUN -#define CMD_PER_LUN 2 +#define CMD_PER_LUN 2 #endif #ifndef CAN_QUEUE -#define CAN_QUEUE 16 +#define CAN_QUEUE 16 #endif #ifndef HOSTS_C @@ -28,24 +28,24 @@ int gvp11_release(struct Scsi_Host *); * if the transfer address ANDed with this results in a non-zero * result, then we can't use DMA. */ -#define GVP11_XFER_MASK (0xff000001) +#define GVP11_XFER_MASK (0xff000001) typedef struct { - unsigned char pad1[64]; - volatile unsigned short CNTR; - unsigned char pad2[31]; - volatile unsigned char SASR; - unsigned char pad3; - volatile unsigned char SCMD; - unsigned char pad4[4]; - volatile unsigned short BANK; - unsigned char pad5[6]; - volatile unsigned long ACR; - volatile unsigned short secret1; /* store 0 here */ - volatile unsigned short ST_DMA; - volatile unsigned short SP_DMA; - volatile unsigned short secret2; /* store 1 here */ - volatile unsigned short secret3; /* store 15 here */ + unsigned char pad1[64]; + volatile unsigned short CNTR; + unsigned char pad2[31]; + volatile unsigned char SASR; + unsigned char pad3; + volatile unsigned char SCMD; + unsigned char pad4[4]; + volatile unsigned short BANK; + unsigned char pad5[6]; + volatile unsigned long ACR; + volatile unsigned short secret1; /* store 0 here */ + volatile unsigned short ST_DMA; + volatile unsigned short SP_DMA; + volatile unsigned short secret2; /* store 1 here */ + volatile unsigned short secret3; /* store 15 here */ } gvp11_scsiregs; /* bits in CNTR */ -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 04/21] m68k/scsi: mvme147 - Reindentation 2010-04-04 9:00 ` [PATCH 03/21] m68k/scsi: gvp11 " Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 05/21] m68k/scsi: a3000 " Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/mvme147.c | 166 ++++++++++++++++++++++++----------------------- drivers/scsi/mvme147.h | 4 +- 2 files changed, 87 insertions(+), 83 deletions(-) diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index a423fcc..b236d72 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c @@ -13,111 +13,115 @@ #include "wd33c93.h" #include "mvme147.h" -#include<linux/stat.h> +#include <linux/stat.h> -#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) + +#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) static struct Scsi_Host *mvme147_host = NULL; -static irqreturn_t mvme147_intr (int irq, void *dummy) +static irqreturn_t mvme147_intr(int irq, void *dummy) { - if (irq == MVME147_IRQ_SCSI_PORT) - wd33c93_intr (mvme147_host); - else - m147_pcc->dma_intr = 0x89; /* Ack and enable ints */ - return IRQ_HANDLED; + if (irq == MVME147_IRQ_SCSI_PORT) + wd33c93_intr(mvme147_host); + else + m147_pcc->dma_intr = 0x89; /* Ack and enable ints */ + return IRQ_HANDLED; } static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { - unsigned char flags = 0x01; - unsigned long addr = virt_to_bus(cmd->SCp.ptr); - - /* setup dma direction */ - if (!dir_in) - flags |= 0x04; - - /* remember direction */ - HDATA(mvme147_host)->dma_dir = dir_in; - - if (dir_in) - /* invalidate any cache */ - cache_clear (addr, cmd->SCp.this_residual); - else - /* push any dirty cache */ - cache_push (addr, cmd->SCp.this_residual); - - /* start DMA */ - m147_pcc->dma_bcr = cmd->SCp.this_residual | (1<<24); - m147_pcc->dma_dadr = addr; - m147_pcc->dma_cntrl = flags; - - /* return success */ - return 0; + unsigned char flags = 0x01; + unsigned long addr = virt_to_bus(cmd->SCp.ptr); + + /* setup dma direction */ + if (!dir_in) + flags |= 0x04; + + /* remember direction */ + HDATA(mvme147_host)->dma_dir = dir_in; + + if (dir_in) { + /* invalidate any cache */ + cache_clear(addr, cmd->SCp.this_residual); + } else { + /* push any dirty cache */ + cache_push(addr, cmd->SCp.this_residual); + } + + /* start DMA */ + m147_pcc->dma_bcr = cmd->SCp.this_residual | (1 << 24); + m147_pcc->dma_dadr = addr; + m147_pcc->dma_cntrl = flags; + + /* return success */ + return 0; } static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, - int status) + int status) { - m147_pcc->dma_cntrl = 0; + m147_pcc->dma_cntrl = 0; } int mvme147_detect(struct scsi_host_template *tpnt) { - static unsigned char called = 0; - wd33c93_regs regs; - - if (!MACH_IS_MVME147 || called) - return 0; - called++; - - tpnt->proc_name = "MVME147"; - tpnt->proc_info = &wd33c93_proc_info; - - mvme147_host = scsi_register (tpnt, sizeof(struct WD33C93_hostdata)); - if (!mvme147_host) - goto err_out; - - mvme147_host->base = 0xfffe4000; - mvme147_host->irq = MVME147_IRQ_SCSI_PORT; - regs.SASR = (volatile unsigned char *)0xfffe4000; - regs.SCMD = (volatile unsigned char *)0xfffe4001; - HDATA(mvme147_host)->no_sync = 0xff; - HDATA(mvme147_host)->fast = 0; - HDATA(mvme147_host)->dma_mode = CTRL_DMA; - wd33c93_init(mvme147_host, regs, dma_setup, dma_stop, WD33C93_FS_8_10); - - if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0, "MVME147 SCSI PORT", mvme147_intr)) - goto err_unregister; - if (request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0, "MVME147 SCSI DMA", mvme147_intr)) - goto err_free_irq; + static unsigned char called = 0; + wd33c93_regs regs; + + if (!MACH_IS_MVME147 || called) + return 0; + called++; + + tpnt->proc_name = "MVME147"; + tpnt->proc_info = &wd33c93_proc_info; + + mvme147_host = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); + if (!mvme147_host) + goto err_out; + + mvme147_host->base = 0xfffe4000; + mvme147_host->irq = MVME147_IRQ_SCSI_PORT; + regs.SASR = (volatile unsigned char *)0xfffe4000; + regs.SCMD = (volatile unsigned char *)0xfffe4001; + HDATA(mvme147_host)->no_sync = 0xff; + HDATA(mvme147_host)->fast = 0; + HDATA(mvme147_host)->dma_mode = CTRL_DMA; + wd33c93_init(mvme147_host, regs, dma_setup, dma_stop, WD33C93_FS_8_10); + + if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0, + "MVME147 SCSI PORT", mvme147_intr)) + goto err_unregister; + if (request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0, + "MVME147 SCSI DMA", mvme147_intr)) + goto err_free_irq; #if 0 /* Disabled; causes problems booting */ - m147_pcc->scsi_interrupt = 0x10; /* Assert SCSI bus reset */ - udelay(100); - m147_pcc->scsi_interrupt = 0x00; /* Negate SCSI bus reset */ - udelay(2000); - m147_pcc->scsi_interrupt = 0x40; /* Clear bus reset interrupt */ + m147_pcc->scsi_interrupt = 0x10; /* Assert SCSI bus reset */ + udelay(100); + m147_pcc->scsi_interrupt = 0x00; /* Negate SCSI bus reset */ + udelay(2000); + m147_pcc->scsi_interrupt = 0x40; /* Clear bus reset interrupt */ #endif - m147_pcc->scsi_interrupt = 0x09; /* Enable interrupt */ + m147_pcc->scsi_interrupt = 0x09; /* Enable interrupt */ - m147_pcc->dma_cntrl = 0x00; /* ensure DMA is stopped */ - m147_pcc->dma_intr = 0x89; /* Ack and enable ints */ + m147_pcc->dma_cntrl = 0x00; /* ensure DMA is stopped */ + m147_pcc->dma_intr = 0x89; /* Ack and enable ints */ - return 1; + return 1; - err_free_irq: - free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr); - err_unregister: - scsi_unregister(mvme147_host); - err_out: - return 0; +err_free_irq: + free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr); +err_unregister: + scsi_unregister(mvme147_host); +err_out: + return 0; } static int mvme147_bus_reset(struct scsi_cmnd *cmd) { /* FIXME perform bus-specific reset */ - /* FIXME 2: kill this function, and let midlayer fallback to + /* FIXME 2: kill this function, and let midlayer fallback to the same result, calling wd33c93_host_reset() */ spin_lock_irq(cmd->device->host->host_lock); @@ -153,9 +157,9 @@ static struct scsi_host_template driver_template = { int mvme147_release(struct Scsi_Host *instance) { #ifdef MODULE - /* XXX Make sure DMA is stopped! */ - free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr); - free_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr); + /* XXX Make sure DMA is stopped! */ + free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr); + free_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr); #endif - return 1; + return 1; } diff --git a/drivers/scsi/mvme147.h b/drivers/scsi/mvme147.h index 32aee85..bfd4566 100644 --- a/drivers/scsi/mvme147.h +++ b/drivers/scsi/mvme147.h @@ -14,11 +14,11 @@ int mvme147_detect(struct scsi_host_template *); int mvme147_release(struct Scsi_Host *); #ifndef CMD_PER_LUN -#define CMD_PER_LUN 2 +#define CMD_PER_LUN 2 #endif #ifndef CAN_QUEUE -#define CAN_QUEUE 16 +#define CAN_QUEUE 16 #endif #endif /* MVME147_H */ -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 05/21] m68k/scsi: a3000 - Reindentation 2010-04-04 9:00 ` [PATCH 04/21] m68k/scsi: mvme147 " Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 06/21] m68k/scsi: a2091 - Use shost_priv() and kill ugly HDATA() macro Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a3000.c | 280 +++++++++++++++++++++++++------------------------- drivers/scsi/a3000.h | 46 ++++---- 2 files changed, 163 insertions(+), 163 deletions(-) diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index 50b10df..b27458e 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -18,26 +18,26 @@ #include "wd33c93.h" #include "a3000.h" -#include<linux/stat.h> +#include <linux/stat.h> -#define DMA(ptr) ((a3000_scsiregs *)((ptr)->base)) -#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) + +#define DMA(ptr) ((a3000_scsiregs *)((ptr)->base)) +#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) static struct Scsi_Host *a3000_host = NULL; static int a3000_release(struct Scsi_Host *instance); -static irqreturn_t a3000_intr (int irq, void *dummy) +static irqreturn_t a3000_intr(int irq, void *dummy) { unsigned long flags; unsigned int status = DMA(a3000_host)->ISTR; if (!(status & ISTR_INT_P)) return IRQ_NONE; - if (status & ISTR_INTS) - { + if (status & ISTR_INTS) { spin_lock_irqsave(a3000_host->host_lock, flags); - wd33c93_intr (a3000_host); + wd33c93_intr(a3000_host); spin_unlock_irqrestore(a3000_host->host_lock, flags); return IRQ_HANDLED; } @@ -47,161 +47,161 @@ static irqreturn_t a3000_intr (int irq, void *dummy) 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); - - /* - * if the physical address has the wrong alignment, or if - * physical address is bad, or if it is a write and at the - * end of a physical memory chunk, then allocate a bounce - * buffer - */ - if (addr & A3000_XFER_MASK) - { - HDATA(a3000_host)->dma_bounce_len = (cmd->SCp.this_residual + 511) - & ~0x1ff; - HDATA(a3000_host)->dma_bounce_buffer = - kmalloc (HDATA(a3000_host)->dma_bounce_len, GFP_KERNEL); - - /* can't allocate memory; use PIO */ - if (!HDATA(a3000_host)->dma_bounce_buffer) { - HDATA(a3000_host)->dma_bounce_len = 0; - return 1; - } - - if (!dir_in) { - /* copy to bounce buffer for a write */ - memcpy (HDATA(a3000_host)->dma_bounce_buffer, - cmd->SCp.ptr, cmd->SCp.this_residual); + unsigned short cntr = CNTR_PDMD | CNTR_INTEN; + unsigned long addr = virt_to_bus(cmd->SCp.ptr); + + /* + * if the physical address has the wrong alignment, or if + * physical address is bad, or if it is a write and at the + * end of a physical memory chunk, then allocate a bounce + * buffer + */ + if (addr & A3000_XFER_MASK) { + HDATA(a3000_host)->dma_bounce_len = + (cmd->SCp.this_residual + 511) & ~0x1ff; + HDATA(a3000_host)->dma_bounce_buffer = + kmalloc(HDATA(a3000_host)->dma_bounce_len, GFP_KERNEL); + + /* can't allocate memory; use PIO */ + if (!HDATA(a3000_host)->dma_bounce_buffer) { + HDATA(a3000_host)->dma_bounce_len = 0; + return 1; + } + + if (!dir_in) { + /* copy to bounce buffer for a write */ + memcpy(HDATA(a3000_host)->dma_bounce_buffer, + cmd->SCp.ptr, cmd->SCp.this_residual); + } + + addr = virt_to_bus(HDATA(a3000_host)->dma_bounce_buffer); } - addr = virt_to_bus(HDATA(a3000_host)->dma_bounce_buffer); - } - - /* setup dma direction */ - if (!dir_in) - cntr |= CNTR_DDIR; + /* setup dma direction */ + if (!dir_in) + cntr |= CNTR_DDIR; - /* remember direction */ - HDATA(a3000_host)->dma_dir = dir_in; + /* remember direction */ + HDATA(a3000_host)->dma_dir = dir_in; - DMA(a3000_host)->CNTR = cntr; + DMA(a3000_host)->CNTR = cntr; - /* setup DMA *physical* address */ - DMA(a3000_host)->ACR = addr; + /* setup DMA *physical* address */ + DMA(a3000_host)->ACR = addr; - if (dir_in) - /* invalidate any cache */ - cache_clear (addr, cmd->SCp.this_residual); - else - /* push any dirty cache */ - cache_push (addr, cmd->SCp.this_residual); + if (dir_in) { + /* invalidate any cache */ + cache_clear(addr, cmd->SCp.this_residual); + } else { + /* push any dirty cache */ + cache_push(addr, cmd->SCp.this_residual); + } - /* start DMA */ - mb(); /* make sure setup is completed */ - DMA(a3000_host)->ST_DMA = 1; - mb(); /* make sure DMA has started before next IO */ + /* start DMA */ + mb(); /* make sure setup is completed */ + DMA(a3000_host)->ST_DMA = 1; + mb(); /* make sure DMA has started before next IO */ - /* return success */ - return 0; + /* return success */ + return 0; } static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { - /* disable SCSI interrupts */ - unsigned short cntr = CNTR_PDMD; - - if (!HDATA(instance)->dma_dir) - cntr |= CNTR_DDIR; - - DMA(instance)->CNTR = cntr; - mb(); /* make sure CNTR is updated before next IO */ - - /* flush if we were reading */ - if (HDATA(instance)->dma_dir) { - DMA(instance)->FLUSH = 1; - mb(); /* don't allow prefetch */ - while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) - barrier(); - mb(); /* no IO until FLUSH is done */ - } - - /* clear a possible interrupt */ - /* I think that this CINT is only necessary if you are - * using the terminal count features. HM 7 Mar 1994 - */ - DMA(instance)->CINT = 1; - - /* stop DMA */ - DMA(instance)->SP_DMA = 1; - mb(); /* make sure DMA is stopped before next IO */ - - /* restore the CONTROL bits (minus the direction flag) */ - DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; - mb(); /* make sure CNTR is updated before next IO */ - - /* copy from a bounce buffer, if necessary */ - if (status && HDATA(instance)->dma_bounce_buffer) { - if (SCpnt) { - if (HDATA(instance)->dma_dir && SCpnt) - 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; - } else { - kfree (HDATA(instance)->dma_bounce_buffer); - HDATA(instance)->dma_bounce_buffer = NULL; - HDATA(instance)->dma_bounce_len = 0; + /* disable SCSI interrupts */ + unsigned short cntr = CNTR_PDMD; + + if (!HDATA(instance)->dma_dir) + cntr |= CNTR_DDIR; + + DMA(instance)->CNTR = cntr; + mb(); /* make sure CNTR is updated before next IO */ + + /* flush if we were reading */ + if (HDATA(instance)->dma_dir) { + DMA(instance)->FLUSH = 1; + mb(); /* don't allow prefetch */ + while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) + barrier(); + mb(); /* no IO until FLUSH is done */ + } + + /* clear a possible interrupt */ + /* I think that this CINT is only necessary if you are + * using the terminal count features. HM 7 Mar 1994 + */ + DMA(instance)->CINT = 1; + + /* stop DMA */ + DMA(instance)->SP_DMA = 1; + mb(); /* make sure DMA is stopped before next IO */ + + /* restore the CONTROL bits (minus the direction flag) */ + DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; + mb(); /* make sure CNTR is updated before next IO */ + + /* copy from a bounce buffer, if necessary */ + if (status && HDATA(instance)->dma_bounce_buffer) { + if (SCpnt) { + if (HDATA(instance)->dma_dir && SCpnt) + 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; + } else { + kfree(HDATA(instance)->dma_bounce_buffer); + HDATA(instance)->dma_bounce_buffer = NULL; + HDATA(instance)->dma_bounce_len = 0; + } } - } } static int __init a3000_detect(struct scsi_host_template *tpnt) { - wd33c93_regs regs; - - if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) - return 0; - if (!request_mem_region(0xDD0000, 256, "wd33c93")) - return 0; - - tpnt->proc_name = "A3000"; - tpnt->proc_info = &wd33c93_proc_info; - - a3000_host = scsi_register (tpnt, sizeof(struct WD33C93_hostdata)); - if (a3000_host == NULL) - goto fail_register; - - a3000_host->base = ZTWO_VADDR(0xDD0000); - a3000_host->irq = IRQ_AMIGA_PORTS; - 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, IRQF_SHARED, "A3000 SCSI", - a3000_intr)) - goto fail_irq; - DMA(a3000_host)->CNTR = CNTR_PDMD | CNTR_INTEN; - - return 1; + wd33c93_regs regs; + + if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) + return 0; + if (!request_mem_region(0xDD0000, 256, "wd33c93")) + return 0; + + tpnt->proc_name = "A3000"; + tpnt->proc_info = &wd33c93_proc_info; + + a3000_host = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); + if (a3000_host == NULL) + goto fail_register; + + a3000_host->base = ZTWO_VADDR(0xDD0000); + a3000_host->irq = IRQ_AMIGA_PORTS; + 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, IRQF_SHARED, "A3000 SCSI", + a3000_intr)) + goto fail_irq; + DMA(a3000_host)->CNTR = CNTR_PDMD | CNTR_INTEN; + + return 1; fail_irq: - scsi_unregister(a3000_host); + scsi_unregister(a3000_host); fail_register: - release_mem_region(0xDD0000, 256); - return 0; + release_mem_region(0xDD0000, 256); + return 0; } static int a3000_bus_reset(struct scsi_cmnd *cmd) { /* FIXME perform bus-specific reset */ - + /* FIXME 2: kill this entire function, which should cause mid-layer to call wd33c93_host_reset anyway? */ @@ -235,10 +235,10 @@ static struct scsi_host_template driver_template = { static int a3000_release(struct Scsi_Host *instance) { - DMA(instance)->CNTR = 0; - release_mem_region(0xDD0000, 256); - free_irq(IRQ_AMIGA_PORTS, a3000_intr); - return 1; + DMA(instance)->CNTR = 0; + release_mem_region(0xDD0000, 256); + free_irq(IRQ_AMIGA_PORTS, a3000_intr); + return 1; } MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/a3000.h b/drivers/scsi/a3000.h index c7afe16..684813e 100644 --- a/drivers/scsi/a3000.h +++ b/drivers/scsi/a3000.h @@ -12,40 +12,40 @@ #include <linux/types.h> #ifndef CMD_PER_LUN -#define CMD_PER_LUN 2 +#define CMD_PER_LUN 2 #endif #ifndef CAN_QUEUE -#define CAN_QUEUE 16 +#define CAN_QUEUE 16 #endif /* * if the transfer address ANDed with this results in a non-zero * result, then we can't use DMA. */ -#define A3000_XFER_MASK (0x00000003) +#define A3000_XFER_MASK (0x00000003) typedef struct { - unsigned char pad1[2]; - volatile unsigned short DAWR; - volatile unsigned int WTC; - unsigned char pad2[2]; - volatile unsigned short CNTR; - volatile unsigned long ACR; - unsigned char pad3[2]; - volatile unsigned short ST_DMA; - unsigned char pad4[2]; - volatile unsigned short FLUSH; - unsigned char pad5[2]; - volatile unsigned short CINT; - unsigned char pad6[2]; - volatile unsigned short ISTR; - unsigned char pad7[30]; - volatile unsigned short SP_DMA; - unsigned char pad8; - volatile unsigned char SASR; - unsigned char pad9; - volatile unsigned char SCMD; + unsigned char pad1[2]; + volatile unsigned short DAWR; + volatile unsigned int WTC; + unsigned char pad2[2]; + volatile unsigned short CNTR; + volatile unsigned long ACR; + unsigned char pad3[2]; + volatile unsigned short ST_DMA; + unsigned char pad4[2]; + volatile unsigned short FLUSH; + unsigned char pad5[2]; + volatile unsigned short CINT; + unsigned char pad6[2]; + volatile unsigned short ISTR; + unsigned char pad7[30]; + volatile unsigned short SP_DMA; + unsigned char pad8; + volatile unsigned char SASR; + unsigned char pad9; + volatile unsigned char SCMD; } a3000_scsiregs; #define DAWR_A3000 (3) -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 06/21] m68k/scsi: a2091 - Use shost_priv() and kill ugly HDATA() macro 2010-04-04 9:00 ` [PATCH 05/21] m68k/scsi: a3000 " Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 07/21] m68k/scsi: gvp11 " Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a2091.c | 56 +++++++++++++++++++++++++------------------------ 1 files changed, 29 insertions(+), 27 deletions(-) diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index f09c8ba..b890b60 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c @@ -22,7 +22,6 @@ #define DMA(ptr) ((a2091_scsiregs *)((ptr)->base)) -#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) static int a2091_release(struct Scsi_Host *instance); @@ -44,39 +43,39 @@ static irqreturn_t a2091_intr(int irq, void *_instance) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { + struct Scsi_Host *instance = cmd->device->host; + struct WD33C93_hostdata *hdata = shost_priv(instance); 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) { - HDATA(instance)->dma_bounce_len = - (cmd->SCp.this_residual + 511) & ~0x1ff; - HDATA(instance)->dma_bounce_buffer = - kmalloc(HDATA(instance)->dma_bounce_len, GFP_KERNEL); + hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; + hdata->dma_bounce_buffer = kmalloc(hdata->dma_bounce_len, + GFP_KERNEL); /* can't allocate memory; use PIO */ - if (!HDATA(instance)->dma_bounce_buffer) { - HDATA(instance)->dma_bounce_len = 0; + if (!hdata->dma_bounce_buffer) { + hdata->dma_bounce_len = 0; return 1; } /* get the physical address of the bounce buffer */ - addr = virt_to_bus(HDATA(instance)->dma_bounce_buffer); + addr = virt_to_bus(hdata->dma_bounce_buffer); /* the bounce buffer may not be in the first 16M of physmem */ if (addr & A2091_XFER_MASK) { /* we could use chipmem... maybe later */ - kfree(HDATA(instance)->dma_bounce_buffer); - HDATA(instance)->dma_bounce_buffer = NULL; - HDATA(instance)->dma_bounce_len = 0; + kfree(hdata->dma_bounce_buffer); + hdata->dma_bounce_buffer = NULL; + hdata->dma_bounce_len = 0; return 1; } if (!dir_in) { /* copy to bounce buffer for a write */ - memcpy(HDATA(instance)->dma_bounce_buffer, - cmd->SCp.ptr, cmd->SCp.this_residual); + memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr, + cmd->SCp.this_residual); } } @@ -85,7 +84,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cntr |= CNTR_DDIR; /* remember direction */ - HDATA(cmd->device->host)->dma_dir = dir_in; + hdata->dma_dir = dir_in; DMA(cmd->device->host)->CNTR = cntr; @@ -109,17 +108,19 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { + struct WD33C93_hostdata *hdata = shost_priv(instance); + /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; - if (!HDATA(instance)->dma_dir) + if (!hdata->dma_dir) cntr |= CNTR_DDIR; /* disable SCSI interrupts */ DMA(instance)->CNTR = cntr; /* flush if we were reading */ - if (HDATA(instance)->dma_dir) { + if (hdata->dma_dir) { DMA(instance)->FLUSH = 1; while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) ; @@ -135,14 +136,13 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; /* copy from a bounce buffer, if necessary */ - if (status && HDATA(instance)->dma_bounce_buffer) { - if (HDATA(instance)->dma_dir) - memcpy(SCpnt->SCp.ptr, - HDATA(instance)->dma_bounce_buffer, + if (status && hdata->dma_bounce_buffer) { + if (hdata->dma_dir) + memcpy(SCpnt->SCp.ptr, hdata->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; + kfree(hdata->dma_bounce_buffer); + hdata->dma_bounce_buffer = NULL; + hdata->dma_bounce_len = 0; } } @@ -153,6 +153,7 @@ static int __init a2091_detect(struct scsi_host_template *tpnt) unsigned long address; struct zorro_dev *z = NULL; wd33c93_regs regs; + struct WD33C93_hostdata *hdata; int num_a2091 = 0; if (!MACH_IS_AMIGA || called) @@ -179,9 +180,10 @@ static int __init a2091_detect(struct scsi_host_template *tpnt) DMA(instance)->DAWR = DAWR_A2091; regs.SASR = &(DMA(instance)->SASR); regs.SCMD = &(DMA(instance)->SCMD); - HDATA(instance)->no_sync = 0xff; - HDATA(instance)->fast = 0; - HDATA(instance)->dma_mode = CTRL_DMA; + hdata = shost_priv(instance); + hdata->no_sync = 0xff; + hdata->fast = 0; + hdata->dma_mode = CTRL_DMA; wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10); if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 07/21] m68k/scsi: gvp11 - Use shost_priv() and kill ugly HDATA() macro 2010-04-04 9:00 ` [PATCH 06/21] m68k/scsi: a2091 - Use shost_priv() and kill ugly HDATA() macro Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 08/21] m68k/scsi: mvme147 " Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/gvp11.c | 93 ++++++++++++++++++++++++------------------------- 1 files changed, 46 insertions(+), 47 deletions(-) diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index 6ec7520..b370591 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c @@ -22,7 +22,6 @@ #define DMA(ptr) ((gvp11_scsiregs *)((ptr)->base)) -#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) static irqreturn_t gvp11_intr(int irq, void *_instance) { @@ -49,70 +48,66 @@ void gvp11_setup(char *str, int *ints) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { + struct Scsi_Host *instance = cmd->device->host; + struct WD33C93_hostdata *hdata = shost_priv(instance); unsigned short cntr = GVP11_DMAC_INT_ENABLE; unsigned long addr = virt_to_bus(cmd->SCp.ptr); int bank_mask; static int scsi_alloc_out_of_range = 0; /* use bounce buffer if the physical address is bad */ - if (addr & HDATA(cmd->device->host)->dma_xfer_mask) { - HDATA(cmd->device->host)->dma_bounce_len = - (cmd->SCp.this_residual + 511) & ~0x1ff; + if (addr & hdata->dma_xfer_mask) { + hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; if (!scsi_alloc_out_of_range) { - HDATA(cmd->device->host)->dma_bounce_buffer = - kmalloc(HDATA(cmd->device->host)->dma_bounce_len, - GFP_KERNEL); - HDATA(cmd->device->host)->dma_buffer_pool = - BUF_SCSI_ALLOCED; + hdata->dma_bounce_buffer = + kmalloc(hdata->dma_bounce_len, GFP_KERNEL); + hdata->dma_buffer_pool = BUF_SCSI_ALLOCED; } if (scsi_alloc_out_of_range || - !HDATA(cmd->device->host)->dma_bounce_buffer) { - HDATA(cmd->device->host)->dma_bounce_buffer = - amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len, + !hdata->dma_bounce_buffer) { + hdata->dma_bounce_buffer = + amiga_chip_alloc(hdata->dma_bounce_len, "GVP II SCSI Bounce Buffer"); - if (!HDATA(cmd->device->host)->dma_bounce_buffer) { - HDATA(cmd->device->host)->dma_bounce_len = 0; + if (!hdata->dma_bounce_buffer) { + hdata->dma_bounce_len = 0; return 1; } - HDATA(cmd->device->host)->dma_buffer_pool = - BUF_CHIP_ALLOCED; + hdata->dma_buffer_pool = BUF_CHIP_ALLOCED; } /* check if the address of the bounce buffer is OK */ - addr = virt_to_bus(HDATA(cmd->device->host)->dma_bounce_buffer); + addr = virt_to_bus(hdata->dma_bounce_buffer); - if (addr & HDATA(cmd->device->host)->dma_xfer_mask) { + if (addr & hdata->dma_xfer_mask) { /* fall back to Chip RAM if address out of range */ - if (HDATA(cmd->device->host)->dma_buffer_pool == - BUF_SCSI_ALLOCED) { - kfree(HDATA(cmd->device->host)->dma_bounce_buffer); + if (hdata->dma_buffer_pool == BUF_SCSI_ALLOCED) { + kfree(hdata->dma_bounce_buffer); scsi_alloc_out_of_range = 1; } else { - amiga_chip_free(HDATA(cmd->device->host)->dma_bounce_buffer); + amiga_chip_free(hdata->dma_bounce_buffer); } - HDATA(cmd->device->host)->dma_bounce_buffer = - amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len, + hdata->dma_bounce_buffer = + amiga_chip_alloc(hdata->dma_bounce_len, "GVP II SCSI Bounce Buffer"); - if (!HDATA(cmd->device->host)->dma_bounce_buffer) { - HDATA(cmd->device->host)->dma_bounce_len = 0; + if (!hdata->dma_bounce_buffer) { + hdata->dma_bounce_len = 0; return 1; } - addr = virt_to_bus(HDATA(cmd->device->host)->dma_bounce_buffer); - HDATA(cmd->device->host)->dma_buffer_pool = - BUF_CHIP_ALLOCED; + addr = virt_to_bus(hdata->dma_bounce_buffer); + hdata->dma_buffer_pool = BUF_CHIP_ALLOCED; } if (!dir_in) { /* copy to bounce buffer for a write */ - memcpy(HDATA(cmd->device->host)->dma_bounce_buffer, - cmd->SCp.ptr, cmd->SCp.this_residual); + memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr, + cmd->SCp.this_residual); } } @@ -120,7 +115,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) if (!dir_in) cntr |= GVP11_DMAC_DIR_WRITE; - HDATA(cmd->device->host)->dma_dir = dir_in; + hdata->dma_dir = dir_in; DMA(cmd->device->host)->CNTR = cntr; /* setup DMA *physical* address */ @@ -134,7 +129,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cache_push(addr, cmd->SCp.this_residual); } - if ((bank_mask = (~HDATA(cmd->device->host)->dma_xfer_mask >> 18) & 0x01c0)) + bank_mask = (~hdata->dma_xfer_mask >> 18) & 0x01c0; + if (bank_mask) DMA(cmd->device->host)->BANK = bank_mask & (addr >> 18); /* start DMA */ @@ -147,25 +143,26 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { + struct WD33C93_hostdata *hdata = shost_priv(instance); + /* stop DMA */ DMA(instance)->SP_DMA = 1; /* remove write bit from CONTROL bits */ DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; /* copy from a bounce buffer, if necessary */ - if (status && HDATA(instance)->dma_bounce_buffer) { - if (HDATA(instance)->dma_dir && SCpnt) - memcpy(SCpnt->SCp.ptr, - HDATA(instance)->dma_bounce_buffer, + if (status && hdata->dma_bounce_buffer) { + if (hdata->dma_dir && SCpnt) + memcpy(SCpnt->SCp.ptr, hdata->dma_bounce_buffer, SCpnt->SCp.this_residual); - if (HDATA(instance)->dma_buffer_pool == BUF_SCSI_ALLOCED) - kfree(HDATA(instance)->dma_bounce_buffer); + if (hdata->dma_buffer_pool == BUF_SCSI_ALLOCED) + kfree(hdata->dma_bounce_buffer); else - amiga_chip_free(HDATA(instance)->dma_bounce_buffer); + amiga_chip_free(hdata->dma_bounce_buffer); - HDATA(instance)->dma_bounce_buffer = NULL; - HDATA(instance)->dma_bounce_len = 0; + hdata->dma_bounce_buffer = NULL; + hdata->dma_bounce_len = 0; } } @@ -179,6 +176,7 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) unsigned int epc; struct zorro_dev *z = NULL; unsigned int default_dma_xfer_mask; + struct WD33C93_hostdata *hdata; wd33c93_regs regs; int num_gvp11 = 0; #ifdef CHECK_WD33C93 @@ -305,10 +303,11 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) instance->irq = IRQ_AMIGA_PORTS; instance->unique_id = z->slotaddr; + hdata = shost_priv(instance); if (gvp11_xfer_mask) - HDATA(instance)->dma_xfer_mask = gvp11_xfer_mask; + hdata->dma_xfer_mask = gvp11_xfer_mask; else - HDATA(instance)->dma_xfer_mask = default_dma_xfer_mask; + hdata->dma_xfer_mask = default_dma_xfer_mask; DMA(instance)->secret2 = 1; DMA(instance)->secret1 = 0; @@ -326,9 +325,9 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) */ regs.SASR = &(DMA(instance)->SASR); regs.SCMD = &(DMA(instance)->SCMD); - HDATA(instance)->no_sync = 0xff; - HDATA(instance)->fast = 0; - HDATA(instance)->dma_mode = CTRL_DMA; + hdata->no_sync = 0xff; + hdata->fast = 0; + hdata->dma_mode = CTRL_DMA; wd33c93_init(instance, regs, dma_setup, dma_stop, (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 : WD33C93_FS_12_15); -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 08/21] m68k/scsi: mvme147 - Use shost_priv() and kill ugly HDATA() macro 2010-04-04 9:00 ` [PATCH 07/21] m68k/scsi: gvp11 " Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 09/21] m68k/scsi: a3000 " Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/mvme147.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index b236d72..716d178 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c @@ -16,8 +16,6 @@ #include <linux/stat.h> -#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) - static struct Scsi_Host *mvme147_host = NULL; static irqreturn_t mvme147_intr(int irq, void *dummy) @@ -31,6 +29,7 @@ static irqreturn_t mvme147_intr(int irq, void *dummy) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { + struct WD33C93_hostdata *hdata = shost_priv(mvme147_host); unsigned char flags = 0x01; unsigned long addr = virt_to_bus(cmd->SCp.ptr); @@ -39,7 +38,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) flags |= 0x04; /* remember direction */ - HDATA(mvme147_host)->dma_dir = dir_in; + hdata->dma_dir = dir_in; if (dir_in) { /* invalidate any cache */ @@ -68,6 +67,7 @@ int mvme147_detect(struct scsi_host_template *tpnt) { static unsigned char called = 0; wd33c93_regs regs; + struct WD33C93_hostdata *hdata; if (!MACH_IS_MVME147 || called) return 0; @@ -84,9 +84,10 @@ int mvme147_detect(struct scsi_host_template *tpnt) mvme147_host->irq = MVME147_IRQ_SCSI_PORT; regs.SASR = (volatile unsigned char *)0xfffe4000; regs.SCMD = (volatile unsigned char *)0xfffe4001; - HDATA(mvme147_host)->no_sync = 0xff; - HDATA(mvme147_host)->fast = 0; - HDATA(mvme147_host)->dma_mode = CTRL_DMA; + hdata = shost_priv(mvme147_host); + hdata->no_sync = 0xff; + hdata->fast = 0; + hdata->dma_mode = CTRL_DMA; wd33c93_init(mvme147_host, regs, dma_setup, dma_stop, WD33C93_FS_8_10); if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0, -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 09/21] m68k/scsi: a3000 - Use shost_priv() and kill ugly HDATA() macro 2010-04-04 9:00 ` [PATCH 08/21] m68k/scsi: mvme147 " Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a3000.c | 53 ++++++++++++++++++++++++++----------------------- 1 files changed, 28 insertions(+), 25 deletions(-) diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index b27458e..44087a0 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -22,7 +22,6 @@ #define DMA(ptr) ((a3000_scsiregs *)((ptr)->base)) -#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) static struct Scsi_Host *a3000_host = NULL; @@ -47,6 +46,7 @@ static irqreturn_t a3000_intr(int irq, void *dummy) 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 long addr = virt_to_bus(cmd->SCp.ptr); @@ -57,24 +57,23 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) * buffer */ if (addr & A3000_XFER_MASK) { - HDATA(a3000_host)->dma_bounce_len = - (cmd->SCp.this_residual + 511) & ~0x1ff; - HDATA(a3000_host)->dma_bounce_buffer = - kmalloc(HDATA(a3000_host)->dma_bounce_len, GFP_KERNEL); + hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; + hdata->dma_bounce_buffer = kmalloc(hdata->dma_bounce_len, + GFP_KERNEL); /* can't allocate memory; use PIO */ - if (!HDATA(a3000_host)->dma_bounce_buffer) { - HDATA(a3000_host)->dma_bounce_len = 0; + if (!hdata->dma_bounce_buffer) { + hdata->dma_bounce_len = 0; return 1; } if (!dir_in) { /* copy to bounce buffer for a write */ - memcpy(HDATA(a3000_host)->dma_bounce_buffer, - cmd->SCp.ptr, cmd->SCp.this_residual); + memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr, + 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 */ @@ -82,7 +81,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cntr |= CNTR_DDIR; /* remember direction */ - HDATA(a3000_host)->dma_dir = dir_in; + hdata->dma_dir = dir_in; DMA(a3000_host)->CNTR = cntr; @@ -109,17 +108,19 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { + struct WD33C93_hostdata *hdata = shost_priv(instance); + /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; - if (!HDATA(instance)->dma_dir) + if (!hdata->dma_dir) cntr |= CNTR_DDIR; DMA(instance)->CNTR = cntr; mb(); /* make sure CNTR is updated before next IO */ /* flush if we were reading */ - if (HDATA(instance)->dma_dir) { + if (hdata->dma_dir) { DMA(instance)->FLUSH = 1; mb(); /* don't allow prefetch */ while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) @@ -142,19 +143,19 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, mb(); /* make sure CNTR is updated before next IO */ /* copy from a bounce buffer, if necessary */ - if (status && HDATA(instance)->dma_bounce_buffer) { + if (status && hdata->dma_bounce_buffer) { if (SCpnt) { - if (HDATA(instance)->dma_dir && SCpnt) + if (hdata->dma_dir && SCpnt) memcpy(SCpnt->SCp.ptr, - HDATA(instance)->dma_bounce_buffer, + hdata->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; + kfree(hdata->dma_bounce_buffer); + hdata->dma_bounce_buffer = NULL; + hdata->dma_bounce_len = 0; } else { - kfree(HDATA(instance)->dma_bounce_buffer); - HDATA(instance)->dma_bounce_buffer = NULL; - HDATA(instance)->dma_bounce_len = 0; + kfree(hdata->dma_bounce_buffer); + hdata->dma_bounce_buffer = NULL; + hdata->dma_bounce_len = 0; } } } @@ -162,6 +163,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, static int __init a3000_detect(struct scsi_host_template *tpnt) { wd33c93_regs regs; + struct WD33C93_hostdata *hdata; if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) return 0; @@ -180,9 +182,10 @@ static int __init a3000_detect(struct 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; + hdata = shost_priv(a3000_host); + hdata->no_sync = 0xff; + hdata->fast = 0; + hdata->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, IRQF_SHARED, "A3000 SCSI", a3000_intr)) -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro 2010-04-04 9:00 ` [PATCH 09/21] m68k/scsi: a3000 " Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 11/21] m68k/scsi: gvp11 " Geert Uytterhoeven 2010-04-05 6:25 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro Christoph Hellwig 0 siblings, 2 replies; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a2091.c | 48 ++++++++++++++++++++++++++---------------------- 1 files changed, 26 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index b890b60..e762cae 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c @@ -21,17 +21,15 @@ #include <linux/stat.h> -#define DMA(ptr) ((a2091_scsiregs *)((ptr)->base)) - static int a2091_release(struct Scsi_Host *instance); -static irqreturn_t a2091_intr(int irq, void *_instance) +static irqreturn_t a2091_intr(int irq, void *data) { + struct Scsi_Host *instance = data; + a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base); + unsigned int status = regs->ISTR; unsigned long flags; - unsigned int status; - struct Scsi_Host *instance = (struct Scsi_Host *)_instance; - status = DMA(instance)->ISTR; if (!(status & (ISTR_INT_F | ISTR_INT_P)) || !(status & ISTR_INTS)) return IRQ_NONE; @@ -45,6 +43,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { struct Scsi_Host *instance = cmd->device->host; struct WD33C93_hostdata *hdata = shost_priv(instance); + a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base); unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); @@ -86,10 +85,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) /* remember direction */ hdata->dma_dir = dir_in; - DMA(cmd->device->host)->CNTR = cntr; + regs->CNTR = cntr; /* setup DMA *physical* address */ - DMA(cmd->device->host)->ACR = addr; + regs->ACR = addr; if (dir_in) { /* invalidate any cache */ @@ -99,7 +98,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cache_push(addr, cmd->SCp.this_residual); } /* start DMA */ - DMA(cmd->device->host)->ST_DMA = 1; + regs->ST_DMA = 1; /* return success */ return 0; @@ -109,6 +108,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { struct WD33C93_hostdata *hdata = shost_priv(instance); + a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base); /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; @@ -117,23 +117,23 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, cntr |= CNTR_DDIR; /* disable SCSI interrupts */ - DMA(instance)->CNTR = cntr; + regs->CNTR = cntr; /* flush if we were reading */ if (hdata->dma_dir) { - DMA(instance)->FLUSH = 1; - while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) + regs->FLUSH = 1; + while (!(regs->ISTR & ISTR_FE_FLG)) ; } /* clear a possible interrupt */ - DMA(instance)->CINT = 1; + regs->CINT = 1; /* stop DMA */ - DMA(instance)->SP_DMA = 1; + regs->SP_DMA = 1; /* restore the CONTROL bits (minus the direction flag) */ - DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; + regs->CNTR = CNTR_PDMD | CNTR_INTEN; /* copy from a bounce buffer, if necessary */ if (status && hdata->dma_bounce_buffer) { @@ -152,7 +152,8 @@ static int __init a2091_detect(struct scsi_host_template *tpnt) struct Scsi_Host *instance; unsigned long address; struct zorro_dev *z = NULL; - wd33c93_regs regs; + wd33c93_regs wdregs; + a2091_scsiregs *regs; struct WD33C93_hostdata *hdata; int num_a2091 = 0; @@ -177,19 +178,20 @@ static int __init a2091_detect(struct scsi_host_template *tpnt) instance->base = ZTWO_VADDR(address); instance->irq = IRQ_AMIGA_PORTS; instance->unique_id = z->slotaddr; - DMA(instance)->DAWR = DAWR_A2091; - regs.SASR = &(DMA(instance)->SASR); - regs.SCMD = &(DMA(instance)->SCMD); + regs = (a2091_scsiregs *)(instance->base); + regs->DAWR = DAWR_A2091; + wdregs.SASR = ®s->SASR; + wdregs.SCMD = ®s->SCMD; hdata = shost_priv(instance); hdata->no_sync = 0xff; hdata->fast = 0; hdata->dma_mode = CTRL_DMA; - wd33c93_init(instance, regs, dma_setup, dma_stop, + wd33c93_init(instance, wdregs, dma_setup, dma_stop, WD33C93_FS_8_10); if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, "A2091 SCSI", instance)) goto unregister; - DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; + regs->CNTR = CNTR_PDMD | CNTR_INTEN; num_a2091++; continue; @@ -240,7 +242,9 @@ static struct scsi_host_template driver_template = { static int a2091_release(struct Scsi_Host *instance) { #ifdef MODULE - DMA(instance)->CNTR = 0; + a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base); + + regs->CNTR = 0; release_mem_region(ZTWO_PADDR(instance->base), 256); free_irq(IRQ_AMIGA_PORTS, instance); #endif -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 11/21] m68k/scsi: gvp11 - Kill ugly DMA() macro 2010-04-04 9:00 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 12/21] m68k/scsi: a3000 " Geert Uytterhoeven 2010-04-05 6:25 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro Christoph Hellwig 1 sibling, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/gvp11.c | 52 ++++++++++++++++++++++++++----------------------- 1 files changed, 28 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index b370591..5f07648 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c @@ -21,15 +21,13 @@ #include <linux/stat.h> -#define DMA(ptr) ((gvp11_scsiregs *)((ptr)->base)) - -static irqreturn_t gvp11_intr(int irq, void *_instance) +static irqreturn_t gvp11_intr(int irq, void *data) { + struct Scsi_Host *instance = data; + gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base); + unsigned int status = regs->CNTR; unsigned long flags; - unsigned int status; - struct Scsi_Host *instance = (struct Scsi_Host *)_instance; - status = DMA(instance)->CNTR; if (!(status & GVP11_DMAC_INT_PENDING)) return IRQ_NONE; @@ -50,6 +48,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { struct Scsi_Host *instance = cmd->device->host; struct WD33C93_hostdata *hdata = shost_priv(instance); + gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base); unsigned short cntr = GVP11_DMAC_INT_ENABLE; unsigned long addr = virt_to_bus(cmd->SCp.ptr); int bank_mask; @@ -116,10 +115,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cntr |= GVP11_DMAC_DIR_WRITE; hdata->dma_dir = dir_in; - DMA(cmd->device->host)->CNTR = cntr; + regs->CNTR = cntr; /* setup DMA *physical* address */ - DMA(cmd->device->host)->ACR = addr; + regs->ACR = addr; if (dir_in) { /* invalidate any cache */ @@ -131,10 +130,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) bank_mask = (~hdata->dma_xfer_mask >> 18) & 0x01c0; if (bank_mask) - DMA(cmd->device->host)->BANK = bank_mask & (addr >> 18); + regs->BANK = bank_mask & (addr >> 18); /* start DMA */ - DMA(cmd->device->host)->ST_DMA = 1; + regs->ST_DMA = 1; /* return success */ return 0; @@ -143,12 +142,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { + gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base); struct WD33C93_hostdata *hdata = shost_priv(instance); /* stop DMA */ - DMA(instance)->SP_DMA = 1; + regs->SP_DMA = 1; /* remove write bit from CONTROL bits */ - DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; + regs->CNTR = GVP11_DMAC_INT_ENABLE; /* copy from a bounce buffer, if necessary */ if (status && hdata->dma_bounce_buffer) { @@ -177,7 +177,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) struct zorro_dev *z = NULL; unsigned int default_dma_xfer_mask; struct WD33C93_hostdata *hdata; - wd33c93_regs regs; + gvp11_scsiregs *regs; + wd33c93_regs wdregs; int num_gvp11 = 0; #ifdef CHECK_WD33C93 volatile unsigned char *sasr_3393, *scmd_3393; @@ -309,33 +310,34 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) else hdata->dma_xfer_mask = default_dma_xfer_mask; - DMA(instance)->secret2 = 1; - DMA(instance)->secret1 = 0; - DMA(instance)->secret3 = 15; - while (DMA(instance)->CNTR & GVP11_DMAC_BUSY) + regs = (gvp11_scsiregs *)(instance->base); + regs->secret2 = 1; + regs->secret1 = 0; + regs->secret3 = 15; + while (regs->CNTR & GVP11_DMAC_BUSY) ; - DMA(instance)->CNTR = 0; + regs->CNTR = 0; - DMA(instance)->BANK = 0; + regs->BANK = 0; epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000); /* * Check for 14MHz SCSI clock */ - regs.SASR = &(DMA(instance)->SASR); - regs.SCMD = &(DMA(instance)->SCMD); + wdregs.SASR = ®s->SASR; + wdregs.SCMD = ®s->SCMD; hdata->no_sync = 0xff; hdata->fast = 0; hdata->dma_mode = CTRL_DMA; - wd33c93_init(instance, regs, dma_setup, dma_stop, + wd33c93_init(instance, wdregs, dma_setup, dma_stop, (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 : WD33C93_FS_12_15); if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, "GVP11 SCSI", instance)) goto unregister; - DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; + regs->CNTR = GVP11_DMAC_INT_ENABLE; num_gvp11++; continue; @@ -390,7 +392,9 @@ static struct scsi_host_template driver_template = { int gvp11_release(struct Scsi_Host *instance) { #ifdef MODULE - DMA(instance)->CNTR = 0; + gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base); + + regs->CNTR = 0; release_mem_region(ZTWO_PADDR(instance->base), 256); free_irq(IRQ_AMIGA_PORTS, instance); #endif -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 12/21] m68k/scsi: a3000 - Kill ugly DMA() macro 2010-04-04 9:00 ` [PATCH 11/21] m68k/scsi: gvp11 " Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 13/21] m68k/scsi: mvme147 - Kill static global mvme147_host Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a3000.c | 44 +++++++++++++++++++++++++------------------- 1 files changed, 25 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index 44087a0..296b58b 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -21,16 +21,15 @@ #include <linux/stat.h> -#define DMA(ptr) ((a3000_scsiregs *)((ptr)->base)) - static struct Scsi_Host *a3000_host = NULL; static int a3000_release(struct Scsi_Host *instance); static irqreturn_t a3000_intr(int irq, void *dummy) { + a3000_scsiregs *regs = (a3000_scsiregs *)(a3000_host->base); + unsigned int status = regs->ISTR; unsigned long flags; - unsigned int status = DMA(a3000_host)->ISTR; if (!(status & ISTR_INT_P)) return IRQ_NONE; @@ -47,6 +46,7 @@ static irqreturn_t a3000_intr(int irq, void *dummy) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { struct WD33C93_hostdata *hdata = shost_priv(a3000_host); + a3000_scsiregs *regs = (a3000_scsiregs *)(a3000_host->base); unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); @@ -83,10 +83,10 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) /* remember direction */ hdata->dma_dir = dir_in; - DMA(a3000_host)->CNTR = cntr; + regs->CNTR = cntr; /* setup DMA *physical* address */ - DMA(a3000_host)->ACR = addr; + regs->ACR = addr; if (dir_in) { /* invalidate any cache */ @@ -98,7 +98,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) /* start DMA */ mb(); /* make sure setup is completed */ - DMA(a3000_host)->ST_DMA = 1; + regs->ST_DMA = 1; mb(); /* make sure DMA has started before next IO */ /* return success */ @@ -109,6 +109,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { struct WD33C93_hostdata *hdata = shost_priv(instance); + a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base); /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; @@ -116,14 +117,14 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, if (!hdata->dma_dir) cntr |= CNTR_DDIR; - DMA(instance)->CNTR = cntr; + regs->CNTR = cntr; mb(); /* make sure CNTR is updated before next IO */ /* flush if we were reading */ if (hdata->dma_dir) { - DMA(instance)->FLUSH = 1; + regs->FLUSH = 1; mb(); /* don't allow prefetch */ - while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) + while (!(regs->ISTR & ISTR_FE_FLG)) barrier(); mb(); /* no IO until FLUSH is done */ } @@ -132,14 +133,14 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, /* I think that this CINT is only necessary if you are * using the terminal count features. HM 7 Mar 1994 */ - DMA(instance)->CINT = 1; + regs->CINT = 1; /* stop DMA */ - DMA(instance)->SP_DMA = 1; + regs->SP_DMA = 1; mb(); /* make sure DMA is stopped before next IO */ /* restore the CONTROL bits (minus the direction flag) */ - DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; + regs->CNTR = CNTR_PDMD | CNTR_INTEN; mb(); /* make sure CNTR is updated before next IO */ /* copy from a bounce buffer, if necessary */ @@ -162,7 +163,8 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, static int __init a3000_detect(struct scsi_host_template *tpnt) { - wd33c93_regs regs; + wd33c93_regs wdregs; + a3000_scsiregs *regs; struct WD33C93_hostdata *hdata; if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) @@ -179,18 +181,20 @@ static int __init a3000_detect(struct scsi_host_template *tpnt) a3000_host->base = ZTWO_VADDR(0xDD0000); a3000_host->irq = IRQ_AMIGA_PORTS; - DMA(a3000_host)->DAWR = DAWR_A3000; - regs.SASR = &(DMA(a3000_host)->SASR); - regs.SCMD = &(DMA(a3000_host)->SCMD); + regs = (a3000_scsiregs *)(a3000_host->base); + regs->DAWR = DAWR_A3000; + wdregs.SASR = ®s->SASR; + wdregs.SCMD = ®s->SCMD; hdata = shost_priv(a3000_host); hdata->no_sync = 0xff; 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, wdregs, dma_setup, dma_stop, + WD33C93_FS_12_15); 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; + regs->CNTR = CNTR_PDMD | CNTR_INTEN; return 1; @@ -238,7 +242,9 @@ static struct scsi_host_template driver_template = { static int a3000_release(struct Scsi_Host *instance) { - DMA(instance)->CNTR = 0; + a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base); + + regs->CNTR = 0; release_mem_region(0xDD0000, 256); free_irq(IRQ_AMIGA_PORTS, a3000_intr); return 1; -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 13/21] m68k/scsi: mvme147 - Kill static global mvme147_host 2010-04-04 9:00 ` [PATCH 12/21] m68k/scsi: a3000 " Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 14/21] m68k/scsi: a3000 - Kill static global a3000_host Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/mvme147.c | 30 ++++++++++++++++-------------- 1 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index 716d178..1b6195b 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c @@ -16,12 +16,12 @@ #include <linux/stat.h> -static struct Scsi_Host *mvme147_host = NULL; - -static irqreturn_t mvme147_intr(int irq, void *dummy) +static irqreturn_t mvme147_intr(int irq, void *data) { + struct Scsi_Host *instance = data; + if (irq == MVME147_IRQ_SCSI_PORT) - wd33c93_intr(mvme147_host); + wd33c93_intr(instance); else m147_pcc->dma_intr = 0x89; /* Ack and enable ints */ return IRQ_HANDLED; @@ -29,7 +29,8 @@ static irqreturn_t mvme147_intr(int irq, void *dummy) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { - struct WD33C93_hostdata *hdata = shost_priv(mvme147_host); + struct Scsi_Host *instance = cmd->device->host; + struct WD33C93_hostdata *hdata = shost_priv(instance); unsigned char flags = 0x01; unsigned long addr = virt_to_bus(cmd->SCp.ptr); @@ -66,6 +67,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int mvme147_detect(struct scsi_host_template *tpnt) { static unsigned char called = 0; + struct Scsi_Host *instance; wd33c93_regs regs; struct WD33C93_hostdata *hdata; @@ -76,25 +78,25 @@ int mvme147_detect(struct scsi_host_template *tpnt) tpnt->proc_name = "MVME147"; tpnt->proc_info = &wd33c93_proc_info; - mvme147_host = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); - if (!mvme147_host) + instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); + if (!instance) goto err_out; - mvme147_host->base = 0xfffe4000; - mvme147_host->irq = MVME147_IRQ_SCSI_PORT; + instance->base = 0xfffe4000; + instance->irq = MVME147_IRQ_SCSI_PORT; regs.SASR = (volatile unsigned char *)0xfffe4000; regs.SCMD = (volatile unsigned char *)0xfffe4001; - hdata = shost_priv(mvme147_host); + hdata = shost_priv(instance); hdata->no_sync = 0xff; hdata->fast = 0; hdata->dma_mode = CTRL_DMA; - wd33c93_init(mvme147_host, regs, dma_setup, dma_stop, WD33C93_FS_8_10); + wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10); if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0, - "MVME147 SCSI PORT", mvme147_intr)) + "MVME147 SCSI PORT", instance)) goto err_unregister; if (request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0, - "MVME147 SCSI DMA", mvme147_intr)) + "MVME147 SCSI DMA", instance)) goto err_free_irq; #if 0 /* Disabled; causes problems booting */ m147_pcc->scsi_interrupt = 0x10; /* Assert SCSI bus reset */ @@ -113,7 +115,7 @@ int mvme147_detect(struct scsi_host_template *tpnt) err_free_irq: free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr); err_unregister: - scsi_unregister(mvme147_host); + scsi_unregister(instance); err_out: return 0; } -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 14/21] m68k/scsi: a3000 - Kill static global a3000_host 2010-04-04 9:00 ` [PATCH 13/21] m68k/scsi: mvme147 - Kill static global mvme147_host Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 15/21] m68k/scsi: gvp11 - Extract check_wd33c93() Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a3000.c | 38 +++++++++++++++++++------------------- 1 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index 296b58b..008a999 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -21,22 +21,21 @@ #include <linux/stat.h> -static struct Scsi_Host *a3000_host = NULL; - static int a3000_release(struct Scsi_Host *instance); -static irqreturn_t a3000_intr(int irq, void *dummy) +static irqreturn_t a3000_intr(int irq, void *data) { - a3000_scsiregs *regs = (a3000_scsiregs *)(a3000_host->base); + struct Scsi_Host *instance = data; + a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base); unsigned int status = regs->ISTR; unsigned long flags; if (!(status & ISTR_INT_P)) return IRQ_NONE; if (status & ISTR_INTS) { - spin_lock_irqsave(a3000_host->host_lock, flags); - wd33c93_intr(a3000_host); - spin_unlock_irqrestore(a3000_host->host_lock, flags); + spin_lock_irqsave(instance->host_lock, flags); + wd33c93_intr(instance); + spin_unlock_irqrestore(instance->host_lock, flags); return IRQ_HANDLED; } printk("Non-serviced A3000 SCSI-interrupt? ISTR = %02x\n", status); @@ -45,8 +44,9 @@ static irqreturn_t a3000_intr(int irq, void *dummy) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { - struct WD33C93_hostdata *hdata = shost_priv(a3000_host); - a3000_scsiregs *regs = (a3000_scsiregs *)(a3000_host->base); + struct Scsi_Host *instance = cmd->device->host; + struct WD33C93_hostdata *hdata = shost_priv(instance); + a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base); unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); @@ -163,6 +163,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, static int __init a3000_detect(struct scsi_host_template *tpnt) { + struct Scsi_Host *instance; wd33c93_regs wdregs; a3000_scsiregs *regs; struct WD33C93_hostdata *hdata; @@ -175,31 +176,30 @@ static int __init a3000_detect(struct scsi_host_template *tpnt) tpnt->proc_name = "A3000"; tpnt->proc_info = &wd33c93_proc_info; - a3000_host = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); - if (a3000_host == NULL) + instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); + if (instance == NULL) goto fail_register; - a3000_host->base = ZTWO_VADDR(0xDD0000); - a3000_host->irq = IRQ_AMIGA_PORTS; - regs = (a3000_scsiregs *)(a3000_host->base); + instance->base = ZTWO_VADDR(0xDD0000); + instance->irq = IRQ_AMIGA_PORTS; + regs = (a3000_scsiregs *)(instance->base); regs->DAWR = DAWR_A3000; wdregs.SASR = ®s->SASR; wdregs.SCMD = ®s->SCMD; - hdata = shost_priv(a3000_host); + hdata = shost_priv(instance); hdata->no_sync = 0xff; hdata->fast = 0; hdata->dma_mode = CTRL_DMA; - wd33c93_init(a3000_host, wdregs, dma_setup, dma_stop, - WD33C93_FS_12_15); + wd33c93_init(instance, wdregs, dma_setup, dma_stop, WD33C93_FS_12_15); if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, "A3000 SCSI", - a3000_intr)) + instance)) goto fail_irq; regs->CNTR = CNTR_PDMD | CNTR_INTEN; return 1; fail_irq: - scsi_unregister(a3000_host); + scsi_unregister(instance); fail_register: release_mem_region(0xDD0000, 256); return 0; -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 15/21] m68k/scsi: gvp11 - Extract check_wd33c93() 2010-04-04 9:00 ` [PATCH 14/21] m68k/scsi: a3000 - Kill static global a3000_host Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 16/21] m68k/scsi: a2091 - Kill a2091_scsiregs typedef Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/gvp11.c | 160 ++++++++++++++++++++++++++------------------------ 1 files changed, 83 insertions(+), 77 deletions(-) diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index 5f07648..265cd27 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c @@ -21,6 +21,8 @@ #include <linux/stat.h> +#define CHECK_WD33C93 + static irqreturn_t gvp11_intr(int irq, void *data) { struct Scsi_Host *instance = data; @@ -166,7 +168,85 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, } } -#define CHECK_WD33C93 +static int __init check_wd33c93(gvp11_scsiregs *regs) +{ +#ifdef CHECK_WD33C93 + volatile unsigned char *sasr_3393, *scmd_3393; + unsigned char save_sasr; + unsigned char q, qq; + + /* + * These darn GVP boards are a problem - it can be tough to tell + * whether or not they include a SCSI controller. This is the + * ultimate Yet-Another-GVP-Detection-Hack in that it actually + * probes for a WD33c93 chip: If we find one, it's extremely + * likely that this card supports SCSI, regardless of Product_ + * Code, Board_Size, etc. + */ + + /* Get pointers to the presumed register locations and save contents */ + + sasr_3393 = ®s->SASR; + scmd_3393 = ®s->SCMD; + save_sasr = *sasr_3393; + + /* First test the AuxStatus Reg */ + + q = *sasr_3393; /* read it */ + if (q & 0x08) /* bit 3 should always be clear */ + return -ENODEV; + *sasr_3393 = WD_AUXILIARY_STATUS; /* setup indirect address */ + if (*sasr_3393 == WD_AUXILIARY_STATUS) { /* shouldn't retain the write */ + *sasr_3393 = save_sasr; /* Oops - restore this byte */ + return -ENODEV; + } + if (*sasr_3393 != q) { /* should still read the same */ + *sasr_3393 = save_sasr; /* Oops - restore this byte */ + return -ENODEV; + } + if (*scmd_3393 != q) /* and so should the image at 0x1f */ + return -ENODEV; + + /* + * Ok, we probably have a wd33c93, but let's check a few other places + * for good measure. Make sure that this works for both 'A and 'B + * chip versions. + */ + + *sasr_3393 = WD_SCSI_STATUS; + q = *scmd_3393; + *sasr_3393 = WD_SCSI_STATUS; + *scmd_3393 = ~q; + *sasr_3393 = WD_SCSI_STATUS; + qq = *scmd_3393; + *sasr_3393 = WD_SCSI_STATUS; + *scmd_3393 = q; + if (qq != q) /* should be read only */ + return -ENODEV; + *sasr_3393 = 0x1e; /* this register is unimplemented */ + q = *scmd_3393; + *sasr_3393 = 0x1e; + *scmd_3393 = ~q; + *sasr_3393 = 0x1e; + qq = *scmd_3393; + *sasr_3393 = 0x1e; + *scmd_3393 = q; + if (qq != q || qq != 0xff) /* should be read only, all 1's */ + return -ENODEV; + *sasr_3393 = WD_TIMEOUT_PERIOD; + q = *scmd_3393; + *sasr_3393 = WD_TIMEOUT_PERIOD; + *scmd_3393 = ~q; + *sasr_3393 = WD_TIMEOUT_PERIOD; + qq = *scmd_3393; + *sasr_3393 = WD_TIMEOUT_PERIOD; + *scmd_3393 = q; + if (qq != (~q & 0xff)) /* should be read/write */ + return -ENODEV; +#endif /* CHECK_WD33C93 */ + + return 0; +} int __init gvp11_detect(struct scsi_host_template *tpnt) { @@ -180,11 +260,6 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) gvp11_scsiregs *regs; wd33c93_regs wdregs; int num_gvp11 = 0; -#ifdef CHECK_WD33C93 - volatile unsigned char *sasr_3393, *scmd_3393; - unsigned char save_sasr; - unsigned char q, qq; -#endif if (!MACH_IS_AMIGA || called) return 0; @@ -225,77 +300,9 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) if (!request_mem_region(address, 256, "wd33c93")) continue; -#ifdef CHECK_WD33C93 - - /* - * These darn GVP boards are a problem - it can be tough to tell - * whether or not they include a SCSI controller. This is the - * ultimate Yet-Another-GVP-Detection-Hack in that it actually - * probes for a WD33c93 chip: If we find one, it's extremely - * likely that this card supports SCSI, regardless of Product_ - * Code, Board_Size, etc. - */ - - /* Get pointers to the presumed register locations and save contents */ - - sasr_3393 = &(((gvp11_scsiregs *)(ZTWO_VADDR(address)))->SASR); - scmd_3393 = &(((gvp11_scsiregs *)(ZTWO_VADDR(address)))->SCMD); - save_sasr = *sasr_3393; - - /* First test the AuxStatus Reg */ - - q = *sasr_3393; /* read it */ - if (q & 0x08) /* bit 3 should always be clear */ - goto release; - *sasr_3393 = WD_AUXILIARY_STATUS; /* setup indirect address */ - if (*sasr_3393 == WD_AUXILIARY_STATUS) { /* shouldn't retain the write */ - *sasr_3393 = save_sasr; /* Oops - restore this byte */ - goto release; - } - if (*sasr_3393 != q) { /* should still read the same */ - *sasr_3393 = save_sasr; /* Oops - restore this byte */ - goto release; - } - if (*scmd_3393 != q) /* and so should the image at 0x1f */ - goto release; - - /* - * Ok, we probably have a wd33c93, but let's check a few other places - * for good measure. Make sure that this works for both 'A and 'B - * chip versions. - */ - - *sasr_3393 = WD_SCSI_STATUS; - q = *scmd_3393; - *sasr_3393 = WD_SCSI_STATUS; - *scmd_3393 = ~q; - *sasr_3393 = WD_SCSI_STATUS; - qq = *scmd_3393; - *sasr_3393 = WD_SCSI_STATUS; - *scmd_3393 = q; - if (qq != q) /* should be read only */ - goto release; - *sasr_3393 = 0x1e; /* this register is unimplemented */ - q = *scmd_3393; - *sasr_3393 = 0x1e; - *scmd_3393 = ~q; - *sasr_3393 = 0x1e; - qq = *scmd_3393; - *sasr_3393 = 0x1e; - *scmd_3393 = q; - if (qq != q || qq != 0xff) /* should be read only, all 1's */ + regs = (gvp11_scsiregs *)(ZTWO_VADDR(address)); + if (check_wd33c93(regs)) goto release; - *sasr_3393 = WD_TIMEOUT_PERIOD; - q = *scmd_3393; - *sasr_3393 = WD_TIMEOUT_PERIOD; - *scmd_3393 = ~q; - *sasr_3393 = WD_TIMEOUT_PERIOD; - qq = *scmd_3393; - *sasr_3393 = WD_TIMEOUT_PERIOD; - *scmd_3393 = q; - if (qq != (~q & 0xff)) /* should be read/write */ - goto release; -#endif instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); if (instance == NULL) @@ -310,7 +317,6 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) else hdata->dma_xfer_mask = default_dma_xfer_mask; - regs = (gvp11_scsiregs *)(instance->base); regs->secret2 = 1; regs->secret1 = 0; regs->secret3 = 15; -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 16/21] m68k/scsi: a2091 - Kill a2091_scsiregs typedef 2010-04-04 9:00 ` [PATCH 15/21] m68k/scsi: gvp11 - Extract check_wd33c93() Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 17/21] m68k/scsi: gvp11 - Kill gvp11_scsiregs typedef Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a2091.c | 12 ++++++------ drivers/scsi/a2091.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index e762cae..ff2cdbb 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c @@ -26,7 +26,7 @@ static int a2091_release(struct Scsi_Host *instance); static irqreturn_t a2091_intr(int irq, void *data) { struct Scsi_Host *instance = data; - a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base); + struct a2091_scsiregs *regs = (struct a2091_scsiregs *)(instance->base); unsigned int status = regs->ISTR; unsigned long flags; @@ -43,7 +43,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { struct Scsi_Host *instance = cmd->device->host; struct WD33C93_hostdata *hdata = shost_priv(instance); - a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base); + struct a2091_scsiregs *regs = (struct a2091_scsiregs *)(instance->base); unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); @@ -108,7 +108,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { struct WD33C93_hostdata *hdata = shost_priv(instance); - a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base); + struct a2091_scsiregs *regs = (struct a2091_scsiregs *)(instance->base); /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; @@ -153,7 +153,7 @@ static int __init a2091_detect(struct scsi_host_template *tpnt) unsigned long address; struct zorro_dev *z = NULL; wd33c93_regs wdregs; - a2091_scsiregs *regs; + struct a2091_scsiregs *regs; struct WD33C93_hostdata *hdata; int num_a2091 = 0; @@ -178,7 +178,7 @@ static int __init a2091_detect(struct scsi_host_template *tpnt) instance->base = ZTWO_VADDR(address); instance->irq = IRQ_AMIGA_PORTS; instance->unique_id = z->slotaddr; - regs = (a2091_scsiregs *)(instance->base); + regs = (struct a2091_scsiregs *)(instance->base); regs->DAWR = DAWR_A2091; wdregs.SASR = ®s->SASR; wdregs.SCMD = ®s->SCMD; @@ -242,7 +242,7 @@ static struct scsi_host_template driver_template = { static int a2091_release(struct Scsi_Host *instance) { #ifdef MODULE - a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base); + struct a2091_scsiregs *regs = (struct a2091_scsiregs *)(instance->base); regs->CNTR = 0; release_mem_region(ZTWO_PADDR(instance->base), 256); diff --git a/drivers/scsi/a2091.h b/drivers/scsi/a2091.h index 1c3daa1..794b8e6 100644 --- a/drivers/scsi/a2091.h +++ b/drivers/scsi/a2091.h @@ -25,7 +25,7 @@ */ #define A2091_XFER_MASK (0xff000001) -typedef struct { +struct a2091_scsiregs { unsigned char pad1[64]; volatile unsigned short ISTR; volatile unsigned short CNTR; @@ -44,7 +44,7 @@ typedef struct { volatile unsigned short CINT; unsigned char pad7[2]; volatile unsigned short FLUSH; -} a2091_scsiregs; +}; #define DAWR_A2091 (3) -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 17/21] m68k/scsi: gvp11 - Kill gvp11_scsiregs typedef 2010-04-04 9:00 ` [PATCH 16/21] m68k/scsi: a2091 - Kill a2091_scsiregs typedef Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 18/21] m68k/scsi: a3000 - Kill a3000_scsiregs typedef Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/gvp11.c | 14 +++++++------- drivers/scsi/gvp11.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index 265cd27..8167b79 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c @@ -26,7 +26,7 @@ static irqreturn_t gvp11_intr(int irq, void *data) { struct Scsi_Host *instance = data; - gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base); + struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base); unsigned int status = regs->CNTR; unsigned long flags; @@ -50,7 +50,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { struct Scsi_Host *instance = cmd->device->host; struct WD33C93_hostdata *hdata = shost_priv(instance); - gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base); + struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base); unsigned short cntr = GVP11_DMAC_INT_ENABLE; unsigned long addr = virt_to_bus(cmd->SCp.ptr); int bank_mask; @@ -144,7 +144,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { - gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base); + struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base); struct WD33C93_hostdata *hdata = shost_priv(instance); /* stop DMA */ @@ -168,7 +168,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, } } -static int __init check_wd33c93(gvp11_scsiregs *regs) +static int __init check_wd33c93(struct gvp11_scsiregs *regs) { #ifdef CHECK_WD33C93 volatile unsigned char *sasr_3393, *scmd_3393; @@ -257,7 +257,7 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) struct zorro_dev *z = NULL; unsigned int default_dma_xfer_mask; struct WD33C93_hostdata *hdata; - gvp11_scsiregs *regs; + struct gvp11_scsiregs *regs; wd33c93_regs wdregs; int num_gvp11 = 0; @@ -300,7 +300,7 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) if (!request_mem_region(address, 256, "wd33c93")) continue; - regs = (gvp11_scsiregs *)(ZTWO_VADDR(address)); + regs = (struct gvp11_scsiregs *)(ZTWO_VADDR(address)); if (check_wd33c93(regs)) goto release; @@ -398,7 +398,7 @@ static struct scsi_host_template driver_template = { int gvp11_release(struct Scsi_Host *instance) { #ifdef MODULE - gvp11_scsiregs *regs = (gvp11_scsiregs *)(instance->base); + struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base); regs->CNTR = 0; release_mem_region(ZTWO_PADDR(instance->base), 256); diff --git a/drivers/scsi/gvp11.h b/drivers/scsi/gvp11.h index e2efdf9..b27a3ee 100644 --- a/drivers/scsi/gvp11.h +++ b/drivers/scsi/gvp11.h @@ -30,7 +30,7 @@ int gvp11_release(struct Scsi_Host *); */ #define GVP11_XFER_MASK (0xff000001) -typedef struct { +struct gvp11_scsiregs { unsigned char pad1[64]; volatile unsigned short CNTR; unsigned char pad2[31]; @@ -46,7 +46,7 @@ typedef struct { volatile unsigned short SP_DMA; volatile unsigned short secret2; /* store 1 here */ volatile unsigned short secret3; /* store 15 here */ -} gvp11_scsiregs; +}; /* bits in CNTR */ #define GVP11_DMAC_BUSY (1<<0) -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 18/21] m68k/scsi: a3000 - Kill a3000_scsiregs typedef 2010-04-04 9:00 ` [PATCH 17/21] m68k/scsi: gvp11 - Kill gvp11_scsiregs typedef Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 19/21] m68k/scsi: mvme147 - Kill obsolete HOSTS_C logic Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a3000.c | 12 ++++++------ drivers/scsi/a3000.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index 008a999..cf3a345 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -26,7 +26,7 @@ static int a3000_release(struct Scsi_Host *instance); static irqreturn_t a3000_intr(int irq, void *data) { struct Scsi_Host *instance = data; - a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base); + struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); unsigned int status = regs->ISTR; unsigned long flags; @@ -46,7 +46,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { struct Scsi_Host *instance = cmd->device->host; struct WD33C93_hostdata *hdata = shost_priv(instance); - a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base); + struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); @@ -109,7 +109,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { struct WD33C93_hostdata *hdata = shost_priv(instance); - a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base); + struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; @@ -165,7 +165,7 @@ static int __init a3000_detect(struct scsi_host_template *tpnt) { struct Scsi_Host *instance; wd33c93_regs wdregs; - a3000_scsiregs *regs; + struct a3000_scsiregs *regs; struct WD33C93_hostdata *hdata; if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) @@ -182,7 +182,7 @@ static int __init a3000_detect(struct scsi_host_template *tpnt) instance->base = ZTWO_VADDR(0xDD0000); instance->irq = IRQ_AMIGA_PORTS; - regs = (a3000_scsiregs *)(instance->base); + regs = (struct a3000_scsiregs *)(instance->base); regs->DAWR = DAWR_A3000; wdregs.SASR = ®s->SASR; wdregs.SCMD = ®s->SCMD; @@ -242,7 +242,7 @@ static struct scsi_host_template driver_template = { static int a3000_release(struct Scsi_Host *instance) { - a3000_scsiregs *regs = (a3000_scsiregs *)(instance->base); + struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); regs->CNTR = 0; release_mem_region(0xDD0000, 256); diff --git a/drivers/scsi/a3000.h b/drivers/scsi/a3000.h index 684813e..49db4a3 100644 --- a/drivers/scsi/a3000.h +++ b/drivers/scsi/a3000.h @@ -25,7 +25,7 @@ */ #define A3000_XFER_MASK (0x00000003) -typedef struct { +struct a3000_scsiregs { unsigned char pad1[2]; volatile unsigned short DAWR; volatile unsigned int WTC; @@ -46,7 +46,7 @@ typedef struct { volatile unsigned char SASR; unsigned char pad9; volatile unsigned char SCMD; -} a3000_scsiregs; +}; #define DAWR_A3000 (3) -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 19/21] m68k/scsi: mvme147 - Kill obsolete HOSTS_C logic 2010-04-04 9:00 ` [PATCH 18/21] m68k/scsi: a3000 - Kill a3000_scsiregs typedef Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 20/21] m68k: amiga - A2091/A590 SCSI zorro_driver conversion Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Kill the obsolete HOSTS_C define and the related double inclusion of mvme147.h Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/mvme147.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index 1b6195b..c29d0db 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c @@ -134,9 +134,6 @@ static int mvme147_bus_reset(struct scsi_cmnd *cmd) return SUCCESS; } -#define HOSTS_C - -#include "mvme147.h" static struct scsi_host_template driver_template = { .proc_name = "MVME147", -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 20/21] m68k: amiga - A2091/A590 SCSI zorro_driver conversion 2010-04-04 9:00 ` [PATCH 19/21] m68k/scsi: mvme147 - Kill obsolete HOSTS_C logic Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 21/21] m68k: amiga - GVP Series II " Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a2091.c | 184 +++++++++++++++++++++++++++---------------------- 1 files changed, 101 insertions(+), 83 deletions(-) diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index ff2cdbb..b06790c 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c @@ -1,27 +1,19 @@ #include <linux/types.h> -#include <linux/mm.h> -#include <linux/blkdev.h> #include <linux/init.h> #include <linux/interrupt.h> +#include <linux/mm.h> +#include <linux/spinlock.h> +#include <linux/zorro.h> -#include <asm/setup.h> #include <asm/page.h> #include <asm/pgtable.h> #include <asm/amigaints.h> #include <asm/amigahw.h> -#include <linux/zorro.h> -#include <asm/irq.h> -#include <linux/spinlock.h> #include "scsi.h" -#include <scsi/scsi_host.h> #include "wd33c93.h" #include "a2091.h" -#include <linux/stat.h> - - -static int a2091_release(struct Scsi_Host *instance); static irqreturn_t a2091_intr(int irq, void *data) { @@ -146,85 +138,27 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, } } -static int __init a2091_detect(struct scsi_host_template *tpnt) -{ - static unsigned char called = 0; - struct Scsi_Host *instance; - unsigned long address; - struct zorro_dev *z = NULL; - wd33c93_regs wdregs; - struct a2091_scsiregs *regs; - struct WD33C93_hostdata *hdata; - int num_a2091 = 0; - - if (!MACH_IS_AMIGA || called) - return 0; - called = 1; - - tpnt->proc_name = "A2091"; - tpnt->proc_info = &wd33c93_proc_info; - - while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { - if (z->id != ZORRO_PROD_CBM_A590_A2091_1 && - z->id != ZORRO_PROD_CBM_A590_A2091_2) - continue; - address = z->resource.start; - if (!request_mem_region(address, 256, "wd33c93")) - continue; - - instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); - if (instance == NULL) - goto release; - instance->base = ZTWO_VADDR(address); - instance->irq = IRQ_AMIGA_PORTS; - instance->unique_id = z->slotaddr; - regs = (struct a2091_scsiregs *)(instance->base); - regs->DAWR = DAWR_A2091; - wdregs.SASR = ®s->SASR; - wdregs.SCMD = ®s->SCMD; - hdata = shost_priv(instance); - hdata->no_sync = 0xff; - hdata->fast = 0; - hdata->dma_mode = CTRL_DMA; - wd33c93_init(instance, wdregs, dma_setup, dma_stop, - WD33C93_FS_8_10); - if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, - "A2091 SCSI", instance)) - goto unregister; - regs->CNTR = CNTR_PDMD | CNTR_INTEN; - num_a2091++; - continue; - -unregister: - scsi_unregister(instance); -release: - release_mem_region(address, 256); - } - - return num_a2091; -} - static int a2091_bus_reset(struct scsi_cmnd *cmd) { + struct Scsi_Host *instance = cmd->device->host; + /* 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); + spin_lock_irq(instance->host_lock); wd33c93_host_reset(cmd); - spin_unlock_irq(cmd->device->host->host_lock); + spin_unlock_irq(instance->host_lock); return SUCCESS; } -#define HOSTS_C - -static struct scsi_host_template driver_template = { - .proc_name = "A2901", +static struct scsi_host_template a2091_scsi_template = { + .module = THIS_MODULE, .name = "Commodore A2091/A590 SCSI", - .detect = a2091_detect, - .release = a2091_release, + .proc_info = wd33c93_proc_info, + .proc_name = "A2901", .queuecommand = wd33c93_queuecommand, .eh_abort_handler = wd33c93_abort, .eh_bus_reset_handler = a2091_bus_reset, @@ -236,19 +170,103 @@ static struct scsi_host_template driver_template = { .use_clustering = DISABLE_CLUSTERING }; +static int __devinit a2091_probe(struct zorro_dev *z, + const struct zorro_device_id *ent) +{ + struct Scsi_Host *instance; + int error; + struct a2091_scsiregs *regs; + wd33c93_regs wdregs; + struct WD33C93_hostdata *hdata; -#include "scsi_module.c" + if (!request_mem_region(z->resource.start, 256, "wd33c93")) + return -EBUSY; -static int a2091_release(struct Scsi_Host *instance) + instance = scsi_host_alloc(&a2091_scsi_template, + sizeof(struct WD33C93_hostdata)); + if (!instance) { + error = -ENOMEM; + goto fail_alloc; + } + + instance->base = ZTWO_VADDR(z->resource.start); + instance->irq = IRQ_AMIGA_PORTS; + instance->unique_id = z->slotaddr; + + regs = (struct a2091_scsiregs *)(instance->base); + regs->DAWR = DAWR_A2091; + + wdregs.SASR = ®s->SASR; + wdregs.SCMD = ®s->SCMD; + + hdata = shost_priv(instance); + hdata->no_sync = 0xff; + hdata->fast = 0; + hdata->dma_mode = CTRL_DMA; + + wd33c93_init(instance, wdregs, dma_setup, dma_stop, WD33C93_FS_8_10); + error = request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, + "A2091 SCSI", instance); + if (error) + goto fail_irq; + + regs->CNTR = CNTR_PDMD | CNTR_INTEN; + + error = scsi_add_host(instance, NULL); + if (error) + goto fail_host; + + zorro_set_drvdata(z, instance); + + scsi_scan_host(instance); + return 0; + +fail_host: + free_irq(IRQ_AMIGA_PORTS, instance); +fail_irq: + scsi_host_put(instance); +fail_alloc: + release_mem_region(z->resource.start, 256); + return error; +} + +static void __devexit a2091_remove(struct zorro_dev *z) { -#ifdef MODULE + struct Scsi_Host *instance = zorro_get_drvdata(z); struct a2091_scsiregs *regs = (struct a2091_scsiregs *)(instance->base); regs->CNTR = 0; - release_mem_region(ZTWO_PADDR(instance->base), 256); + scsi_remove_host(instance); free_irq(IRQ_AMIGA_PORTS, instance); -#endif - return 1; + scsi_host_put(instance); + release_mem_region(z->resource.start, 256); +} + +static struct zorro_device_id a2091_zorro_tbl[] __devinitdata = { + { ZORRO_PROD_CBM_A590_A2091_1 }, + { ZORRO_PROD_CBM_A590_A2091_2 }, + { 0 } +}; +MODULE_DEVICE_TABLE(zorro, a2091_zorro_tbl); + +static struct zorro_driver a2091_driver = { + .name = "a2091", + .id_table = a2091_zorro_tbl, + .probe = a2091_probe, + .remove = __devexit_p(a2091_remove), +}; + +static int __init a2091_init(void) +{ + return zorro_register_driver(&a2091_driver); +} +module_init(a2091_init); + +static void __exit a2091_exit(void) +{ + zorro_unregister_driver(&a2091_driver); } +module_exit(a2091_exit); +MODULE_DESCRIPTION("Commodore A2091/A590 SCSI"); MODULE_LICENSE("GPL"); -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH 21/21] m68k: amiga - GVP Series II SCSI zorro_driver conversion 2010-04-04 9:00 ` [PATCH 20/21] m68k: amiga - A2091/A590 SCSI zorro_driver conversion Geert Uytterhoeven @ 2010-04-04 9:00 ` Geert Uytterhoeven 0 siblings, 0 replies; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-04 9:00 UTC (permalink / raw) To: James E.J. Bottomley; +Cc: linux-m68k, linux-scsi, Geert Uytterhoeven Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/gvp11.c | 296 ++++++++++++++++++++++++++------------------------ drivers/scsi/gvp11.h | 7 - 2 files changed, 155 insertions(+), 148 deletions(-) diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index 8167b79..6a89afc 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c @@ -1,25 +1,19 @@ #include <linux/types.h> -#include <linux/mm.h> -#include <linux/blkdev.h> #include <linux/init.h> #include <linux/interrupt.h> +#include <linux/mm.h> +#include <linux/spinlock.h> +#include <linux/zorro.h> -#include <asm/setup.h> #include <asm/page.h> #include <asm/pgtable.h> #include <asm/amigaints.h> #include <asm/amigahw.h> -#include <linux/zorro.h> -#include <asm/irq.h> -#include <linux/spinlock.h> #include "scsi.h" -#include <scsi/scsi_host.h> #include "wd33c93.h" #include "gvp11.h" -#include <linux/stat.h> - #define CHECK_WD33C93 @@ -168,7 +162,40 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, } } -static int __init check_wd33c93(struct gvp11_scsiregs *regs) +static int gvp11_bus_reset(struct scsi_cmnd *cmd) +{ + struct Scsi_Host *instance = cmd->device->host; + + /* FIXME perform bus-specific reset */ + + /* FIXME 2: shouldn't we no-op this function (return + FAILED), and fall back to host reset function, + wd33c93_host_reset ? */ + + spin_lock_irq(instance->host_lock); + wd33c93_host_reset(cmd); + spin_unlock_irq(instance->host_lock); + + return SUCCESS; +} + +static struct scsi_host_template gvp11_scsi_template = { + .module = THIS_MODULE, + .name = "GVP Series II SCSI", + .proc_info = wd33c93_proc_info, + .proc_name = "GVP11", + .queuecommand = wd33c93_queuecommand, + .eh_abort_handler = wd33c93_abort, + .eh_bus_reset_handler = gvp11_bus_reset, + .eh_host_reset_handler = wd33c93_host_reset, + .can_queue = CAN_QUEUE, + .this_id = 7, + .sg_tablesize = SG_ALL, + .cmd_per_lun = CMD_PER_LUN, + .use_clustering = DISABLE_CLUSTERING +}; + +static int __devinit check_wd33c93(struct gvp11_scsiregs *regs) { #ifdef CHECK_WD33C93 volatile unsigned char *sasr_3393, *scmd_3393; @@ -248,163 +275,150 @@ static int __init check_wd33c93(struct gvp11_scsiregs *regs) return 0; } -int __init gvp11_detect(struct scsi_host_template *tpnt) +static int __devinit gvp11_probe(struct zorro_dev *z, + const struct zorro_device_id *ent) { - static unsigned char called = 0; struct Scsi_Host *instance; unsigned long address; + int error; unsigned int epc; - struct zorro_dev *z = NULL; unsigned int default_dma_xfer_mask; struct WD33C93_hostdata *hdata; struct gvp11_scsiregs *regs; wd33c93_regs wdregs; - int num_gvp11 = 0; - - if (!MACH_IS_AMIGA || called) - return 0; - called = 1; - - tpnt->proc_name = "GVP11"; - tpnt->proc_info = &wd33c93_proc_info; - - while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { - /* - * This should (hopefully) be the correct way to identify - * all the different GVP SCSI controllers (except for the - * SERIES I though). - */ - - if (z->id == ZORRO_PROD_GVP_COMBO_030_R3_SCSI || - z->id == ZORRO_PROD_GVP_SERIES_II) - default_dma_xfer_mask = ~0x00ffffff; - else if (z->id == ZORRO_PROD_GVP_GFORCE_030_SCSI || - z->id == ZORRO_PROD_GVP_A530_SCSI || - z->id == ZORRO_PROD_GVP_COMBO_030_R4_SCSI) - default_dma_xfer_mask = ~0x01ffffff; - else if (z->id == ZORRO_PROD_GVP_A1291 || - z->id == ZORRO_PROD_GVP_GFORCE_040_SCSI_1) - default_dma_xfer_mask = ~0x07ffffff; - else - continue; - - /* - * Rumors state that some GVP ram boards use the same product - * code as the SCSI controllers. Therefore if the board-size - * is not 64KB we asume it is a ram board and bail out. - */ - if (z->resource.end - z->resource.start != 0xffff) - continue; - - address = z->resource.start; - if (!request_mem_region(address, 256, "wd33c93")) - continue; - - regs = (struct gvp11_scsiregs *)(ZTWO_VADDR(address)); - if (check_wd33c93(regs)) - goto release; - - instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); - if (instance == NULL) - goto release; - instance->base = ZTWO_VADDR(address); - instance->irq = IRQ_AMIGA_PORTS; - instance->unique_id = z->slotaddr; - - hdata = shost_priv(instance); - if (gvp11_xfer_mask) - hdata->dma_xfer_mask = gvp11_xfer_mask; - else - hdata->dma_xfer_mask = default_dma_xfer_mask; - - regs->secret2 = 1; - regs->secret1 = 0; - regs->secret3 = 15; - while (regs->CNTR & GVP11_DMAC_BUSY) - ; - regs->CNTR = 0; - - regs->BANK = 0; - - epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000); - - /* - * Check for 14MHz SCSI clock - */ - wdregs.SASR = ®s->SASR; - wdregs.SCMD = ®s->SCMD; - hdata->no_sync = 0xff; - hdata->fast = 0; - hdata->dma_mode = CTRL_DMA; - wd33c93_init(instance, wdregs, dma_setup, dma_stop, - (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 - : WD33C93_FS_12_15); - - if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, - "GVP11 SCSI", instance)) - goto unregister; - regs->CNTR = GVP11_DMAC_INT_ENABLE; - num_gvp11++; - continue; - -unregister: - scsi_unregister(instance); -release: - release_mem_region(address, 256); + + default_dma_xfer_mask = ent->driver_data; + + /* + * Rumors state that some GVP ram boards use the same product + * code as the SCSI controllers. Therefore if the board-size + * is not 64KB we asume it is a ram board and bail out. + */ + if (zorro_resource_len(z) != 0x10000) + return -ENODEV; + + address = z->resource.start; + if (!request_mem_region(address, 256, "wd33c93")) + return -EBUSY; + + regs = (struct gvp11_scsiregs *)(ZTWO_VADDR(address)); + + error = check_wd33c93(regs); + if (error) + goto fail_check_or_alloc; + + instance = scsi_host_alloc(&gvp11_scsi_template, + sizeof(struct WD33C93_hostdata)); + if (!instance) { + error = -ENOMEM; + goto fail_check_or_alloc; } - return num_gvp11; -} + instance->base = (unsigned long)regs; + instance->irq = IRQ_AMIGA_PORTS; + instance->unique_id = z->slotaddr; -static int gvp11_bus_reset(struct scsi_cmnd *cmd) -{ - /* FIXME perform bus-specific reset */ + regs->secret2 = 1; + regs->secret1 = 0; + regs->secret3 = 15; + while (regs->CNTR & GVP11_DMAC_BUSY) + ; + regs->CNTR = 0; + regs->BANK = 0; - /* FIXME 2: shouldn't we no-op this function (return - FAILED), and fall back to host reset function, - wd33c93_host_reset ? */ + wdregs.SASR = ®s->SASR; + wdregs.SCMD = ®s->SCMD; - spin_lock_irq(cmd->device->host->host_lock); - wd33c93_host_reset(cmd); - spin_unlock_irq(cmd->device->host->host_lock); + hdata = shost_priv(instance); + if (gvp11_xfer_mask) + hdata->dma_xfer_mask = gvp11_xfer_mask; + else + hdata->dma_xfer_mask = default_dma_xfer_mask; - return SUCCESS; -} + hdata->no_sync = 0xff; + hdata->fast = 0; + hdata->dma_mode = CTRL_DMA; + /* + * Check for 14MHz SCSI clock + */ + epc = *(unsigned short *)(ZTWO_VADDR(address) + 0x8000); + wd33c93_init(instance, wdregs, dma_setup, dma_stop, + (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 + : WD33C93_FS_12_15); -#define HOSTS_C + error = request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, + "GVP11 SCSI", instance); + if (error) + goto fail_irq; -#include "gvp11.h" + regs->CNTR = GVP11_DMAC_INT_ENABLE; -static struct scsi_host_template driver_template = { - .proc_name = "GVP11", - .name = "GVP Series II SCSI", - .detect = gvp11_detect, - .release = gvp11_release, - .queuecommand = wd33c93_queuecommand, - .eh_abort_handler = wd33c93_abort, - .eh_bus_reset_handler = gvp11_bus_reset, - .eh_host_reset_handler = wd33c93_host_reset, - .can_queue = CAN_QUEUE, - .this_id = 7, - .sg_tablesize = SG_ALL, - .cmd_per_lun = CMD_PER_LUN, - .use_clustering = DISABLE_CLUSTERING -}; + error = scsi_add_host(instance, NULL); + if (error) + goto fail_host; + zorro_set_drvdata(z, instance); + scsi_scan_host(instance); + return 0; -#include "scsi_module.c" +fail_host: + free_irq(IRQ_AMIGA_PORTS, instance); +fail_irq: + scsi_host_put(instance); +fail_check_or_alloc: + release_mem_region(address, 256); + return error; +} -int gvp11_release(struct Scsi_Host *instance) +static void __devexit gvp11_remove(struct zorro_dev *z) { -#ifdef MODULE + struct Scsi_Host *instance = zorro_get_drvdata(z); struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base); regs->CNTR = 0; - release_mem_region(ZTWO_PADDR(instance->base), 256); + scsi_remove_host(instance); free_irq(IRQ_AMIGA_PORTS, instance); -#endif - return 1; + scsi_host_put(instance); + release_mem_region(z->resource.start, 256); +} + + /* + * This should (hopefully) be the correct way to identify + * all the different GVP SCSI controllers (except for the + * SERIES I though). + */ + +static struct zorro_device_id gvp11_zorro_tbl[] __devinitdata = { + { ZORRO_PROD_GVP_COMBO_030_R3_SCSI, ~0x00ffffff }, + { ZORRO_PROD_GVP_SERIES_II, ~0x00ffffff }, + { ZORRO_PROD_GVP_GFORCE_030_SCSI, ~0x01ffffff }, + { ZORRO_PROD_GVP_A530_SCSI, ~0x01ffffff }, + { ZORRO_PROD_GVP_COMBO_030_R4_SCSI, ~0x01ffffff }, + { ZORRO_PROD_GVP_A1291, ~0x07ffffff }, + { ZORRO_PROD_GVP_GFORCE_040_SCSI_1, ~0x07ffffff }, + { 0 } +}; +MODULE_DEVICE_TABLE(zorro, gvp11_zorro_tbl); + +static struct zorro_driver gvp11_driver = { + .name = "gvp11", + .id_table = gvp11_zorro_tbl, + .probe = gvp11_probe, + .remove = __devexit_p(gvp11_remove), +}; + +static int __init gvp11_init(void) +{ + return zorro_register_driver(&gvp11_driver); +} +module_init(gvp11_init); + +static void __exit gvp11_exit(void) +{ + zorro_unregister_driver(&gvp11_driver); } +module_exit(gvp11_exit); +MODULE_DESCRIPTION("GVP Series II SCSI"); MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/gvp11.h b/drivers/scsi/gvp11.h index b27a3ee..852913c 100644 --- a/drivers/scsi/gvp11.h +++ b/drivers/scsi/gvp11.h @@ -11,9 +11,6 @@ #include <linux/types.h> -int gvp11_detect(struct scsi_host_template *); -int gvp11_release(struct Scsi_Host *); - #ifndef CMD_PER_LUN #define CMD_PER_LUN 2 #endif @@ -22,8 +19,6 @@ int gvp11_release(struct Scsi_Host *); #define CAN_QUEUE 16 #endif -#ifndef HOSTS_C - /* * if the transfer address ANDed with this results in a non-zero * result, then we can't use DMA. @@ -54,6 +49,4 @@ struct gvp11_scsiregs { #define GVP11_DMAC_INT_ENABLE (1<<3) #define GVP11_DMAC_DIR_WRITE (1<<4) -#endif /* else def HOSTS_C */ - #endif /* GVP11_H */ -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro 2010-04-04 9:00 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 11/21] m68k/scsi: gvp11 " Geert Uytterhoeven @ 2010-04-05 6:25 ` Christoph Hellwig 2010-04-05 19:42 ` Geert Uytterhoeven 1 sibling, 1 reply; 32+ messages in thread From: Christoph Hellwig @ 2010-04-05 6:25 UTC (permalink / raw) To: Geert Uytterhoeven; +Cc: James E.J. Bottomley, linux-m68k, linux-scsi Instead of abusing the ScsiHost base field I'd prefer if you stick a properly typed pointer into the device specific host data. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro 2010-04-05 6:25 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro Christoph Hellwig @ 2010-04-05 19:42 ` Geert Uytterhoeven 2010-04-23 8:37 ` Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-05 19:42 UTC (permalink / raw) To: Christoph Hellwig Cc: James E.J. Bottomley, linux-m68k, linux-scsi, Ralf Baechle On Mon, Apr 5, 2010 at 08:25, Christoph Hellwig <hch@infradead.org> wrote: > Instead of abusing the ScsiHost base field I'd prefer if you stick I wouldn't call it abuse: it's a (MM)IO base address anyway. But I see that field was indeed marked `legacy crap' in an otherwise innocent looking commit to split the SCSI include files... by you ;-) > a properly typed pointer into the device specific host data. You mean shost_priv()? That field already contains a pointer to the struct WD33C93_hostdata. But I'll create a new a2091_hostdata struct that contains both the WD33C93_hostdata and the a2091_scsiregs pointer (and do the same for gvp11.c and a3000.c). It's a bit similar to what sgiwd93.c does, albeit that one also uses the legacy base field. Thx! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro 2010-04-05 19:42 ` Geert Uytterhoeven @ 2010-04-23 8:37 ` Geert Uytterhoeven 2010-04-23 8:38 ` Geert Uytterhoeven 2010-05-02 20:05 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro James Bottomley 0 siblings, 2 replies; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-23 8:37 UTC (permalink / raw) To: Christoph Hellwig Cc: James E.J. Bottomley, linux-m68k, linux-scsi, Ralf Baechle On Mon, Apr 5, 2010 at 21:42, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Mon, Apr 5, 2010 at 08:25, Christoph Hellwig <hch@infradead.org> wrote: >> Instead of abusing the ScsiHost base field I'd prefer if you stick > > I wouldn't call it abuse: it's a (MM)IO base address anyway. > But I see that field was indeed marked `legacy crap' in an otherwise > innocent looking > commit to split the SCSI include files... by you ;-) > >> a properly typed pointer into the device specific host data. > > You mean shost_priv()? That field already contains a pointer to the > struct WD33C93_hostdata. > > But I'll create a new a2091_hostdata struct that contains both the > WD33C93_hostdata and the a2091_scsiregs pointer (and do the same > for gvp11.c and a3000.c). It's a bit similar to what sgiwd93.c does, albeit that > one also uses the legacy base field. As I want to avoid introducing bugs by respinning the complicated parts (the zorro driver and platform driver conversion patches), I made this change on top of the 2 whole patch series. A2091 part: >From 946570304749544236059dcc65e85e9370e2d745 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert@linux-m68k.org> Date: Mon, 12 Apr 2010 21:55:03 +0200 Subject: [PATCH] m68k/scsi: a2091 - Do not use legacy Scsi_Host.base Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a2091.c | 75 +++++++++++++++++++++++++++---------------------- 1 files changed, 41 insertions(+), 34 deletions(-) diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index fc4fce9..1bb5d3f 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c @@ -16,11 +16,16 @@ #include "a2091.h" +struct a2091_hostdata { + struct WD33C93_hostdata wh; + struct a2091_scsiregs *regs; +}; + static irqreturn_t a2091_intr(int irq, void *data) { struct Scsi_Host *instance = data; - struct a2091_scsiregs *regs = (struct a2091_scsiregs *)(instance->base); - unsigned int status = regs->ISTR; + struct a2091_hostdata *hdata = shost_priv(instance); + unsigned int status = hdata->regs->ISTR; unsigned long flags; if (!(status & (ISTR_INT_F | ISTR_INT_P)) || !(status & ISTR_INTS)) @@ -35,38 +40,39 @@ static irqreturn_t a2091_intr(int irq, void *data) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { struct Scsi_Host *instance = cmd->device->host; - struct WD33C93_hostdata *hdata = shost_priv(instance); - struct a2091_scsiregs *regs = (struct a2091_scsiregs *)(instance->base); + struct a2091_hostdata *hdata = shost_priv(instance); + struct WD33C93_hostdata *wh = &hdata->wh; + struct a2091_scsiregs *regs = hdata->regs; unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); /* don't allow DMA if the physical address is bad */ if (addr & A2091_XFER_MASK) { - hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; - hdata->dma_bounce_buffer = kmalloc(hdata->dma_bounce_len, - GFP_KERNEL); + wh->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; + wh->dma_bounce_buffer = kmalloc(wh->dma_bounce_len, + GFP_KERNEL); /* can't allocate memory; use PIO */ - if (!hdata->dma_bounce_buffer) { - hdata->dma_bounce_len = 0; + if (!wh->dma_bounce_buffer) { + wh->dma_bounce_len = 0; return 1; } /* get the physical address of the bounce buffer */ - addr = virt_to_bus(hdata->dma_bounce_buffer); + addr = virt_to_bus(wh->dma_bounce_buffer); /* the bounce buffer may not be in the first 16M of physmem */ if (addr & A2091_XFER_MASK) { /* we could use chipmem... maybe later */ - kfree(hdata->dma_bounce_buffer); - hdata->dma_bounce_buffer = NULL; - hdata->dma_bounce_len = 0; + kfree(wh->dma_bounce_buffer); + wh->dma_bounce_buffer = NULL; + wh->dma_bounce_len = 0; return 1; } if (!dir_in) { /* copy to bounce buffer for a write */ - memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr, + memcpy(wh->dma_bounce_buffer, cmd->SCp.ptr, cmd->SCp.this_residual); } } @@ -76,7 +82,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cntr |= CNTR_DDIR; /* remember direction */ - hdata->dma_dir = dir_in; + wh->dma_dir = dir_in; regs->CNTR = cntr; @@ -100,20 +106,21 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { - struct WD33C93_hostdata *hdata = shost_priv(instance); - struct a2091_scsiregs *regs = (struct a2091_scsiregs *)(instance->base); + struct a2091_hostdata *hdata = shost_priv(instance); + struct WD33C93_hostdata *wh = &hdata->wh; + struct a2091_scsiregs *regs = hdata->regs; /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; - if (!hdata->dma_dir) + if (!wh->dma_dir) cntr |= CNTR_DDIR; /* disable SCSI interrupts */ regs->CNTR = cntr; /* flush if we were reading */ - if (hdata->dma_dir) { + if (wh->dma_dir) { regs->FLUSH = 1; while (!(regs->ISTR & ISTR_FE_FLG)) ; @@ -129,13 +136,13 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, regs->CNTR = CNTR_PDMD | CNTR_INTEN; /* copy from a bounce buffer, if necessary */ - if (status && hdata->dma_bounce_buffer) { - if (hdata->dma_dir) - memcpy(SCpnt->SCp.ptr, hdata->dma_bounce_buffer, + if (status && wh->dma_bounce_buffer) { + if (wh->dma_dir) + memcpy(SCpnt->SCp.ptr, wh->dma_bounce_buffer, SCpnt->SCp.this_residual); - kfree(hdata->dma_bounce_buffer); - hdata->dma_bounce_buffer = NULL; - hdata->dma_bounce_len = 0; + kfree(wh->dma_bounce_buffer); + wh->dma_bounce_buffer = NULL; + wh->dma_bounce_len = 0; } } @@ -178,32 +185,32 @@ static int __devinit a2091_probe(struct zorro_dev *z, int error; struct a2091_scsiregs *regs; wd33c93_regs wdregs; - struct WD33C93_hostdata *hdata; + struct a2091_hostdata *hdata; if (!request_mem_region(z->resource.start, 256, "wd33c93")) return -EBUSY; instance = scsi_host_alloc(&a2091_scsi_template, - sizeof(struct WD33C93_hostdata)); + sizeof(struct a2091_hostdata)); if (!instance) { error = -ENOMEM; goto fail_alloc; } - instance->base = ZTWO_VADDR(z->resource.start); instance->irq = IRQ_AMIGA_PORTS; instance->unique_id = z->slotaddr; - regs = (struct a2091_scsiregs *)(instance->base); + regs = (struct a2091_scsiregs *)ZTWO_VADDR(z->resource.start); regs->DAWR = DAWR_A2091; wdregs.SASR = ®s->SASR; wdregs.SCMD = ®s->SCMD; hdata = shost_priv(instance); - hdata->no_sync = 0xff; - hdata->fast = 0; - hdata->dma_mode = CTRL_DMA; + hdata->wh.no_sync = 0xff; + hdata->wh.fast = 0; + hdata->wh.dma_mode = CTRL_DMA; + hdata->regs = regs; wd33c93_init(instance, wdregs, dma_setup, dma_stop, WD33C93_FS_8_10); error = request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, @@ -234,9 +241,9 @@ fail_alloc: static void __devexit a2091_remove(struct zorro_dev *z) { struct Scsi_Host *instance = zorro_get_drvdata(z); - struct a2091_scsiregs *regs = (struct a2091_scsiregs *)(instance->base); + struct a2091_hostdata *hdata = shost_priv(instance); - regs->CNTR = 0; + hdata->regs->CNTR = 0; scsi_remove_host(instance); free_irq(IRQ_AMIGA_PORTS, instance); scsi_host_put(instance); -- 1.6.0.4 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro 2010-04-23 8:37 ` Geert Uytterhoeven @ 2010-04-23 8:38 ` Geert Uytterhoeven 2010-04-23 8:40 ` Geert Uytterhoeven 2010-05-02 20:05 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro James Bottomley 1 sibling, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-23 8:38 UTC (permalink / raw) To: Christoph Hellwig Cc: James E.J. Bottomley, linux-m68k, linux-scsi, Ralf Baechle On Fri, Apr 23, 2010 at 10:37, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Mon, Apr 5, 2010 at 21:42, Geert Uytterhoeven <geert@linux-m68k.org> wrote: >> On Mon, Apr 5, 2010 at 08:25, Christoph Hellwig <hch@infradead.org> wrote: >>> Instead of abusing the ScsiHost base field I'd prefer if you stick >> >> I wouldn't call it abuse: it's a (MM)IO base address anyway. >> But I see that field was indeed marked `legacy crap' in an otherwise >> innocent looking >> commit to split the SCSI include files... by you ;-) >> >>> a properly typed pointer into the device specific host data. >> >> You mean shost_priv()? That field already contains a pointer to the >> struct WD33C93_hostdata. >> >> But I'll create a new a2091_hostdata struct that contains both the >> WD33C93_hostdata and the a2091_scsiregs pointer (and do the same >> for gvp11.c and a3000.c). It's a bit similar to what sgiwd93.c does, albeit that >> one also uses the legacy base field. > > As I want to avoid introducing bugs by respinning the complicated > parts (the zorro > driver and platform driver conversion patches), I made this change on > top of the 2 > whole patch series. GVP II part: >From 60f48c686a1014cd3f5722a2180fb8b759a3a59c Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert@linux-m68k.org> Date: Mon, 12 Apr 2010 21:55:25 +0200 Subject: [PATCH] m68k/scsi: gvp11 - Do not use legacy Scsi_Host.base Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/gvp11.c | 105 ++++++++++++++++++++++++++----------------------- 1 files changed, 56 insertions(+), 49 deletions(-) diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index 4507a16..2ce26eb 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c @@ -18,11 +18,16 @@ #define CHECK_WD33C93 +struct gvp11_hostdata { + struct WD33C93_hostdata wh; + struct gvp11_scsiregs *regs; +}; + static irqreturn_t gvp11_intr(int irq, void *data) { struct Scsi_Host *instance = data; - struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base); - unsigned int status = regs->CNTR; + struct gvp11_hostdata *hdata = shost_priv(instance); + unsigned int status = hdata->regs->CNTR; unsigned long flags; if (!(status & GVP11_DMAC_INT_PENDING)) @@ -44,65 +49,66 @@ void gvp11_setup(char *str, int *ints) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { struct Scsi_Host *instance = cmd->device->host; - struct WD33C93_hostdata *hdata = shost_priv(instance); - struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base); + struct gvp11_hostdata *hdata = shost_priv(instance); + struct WD33C93_hostdata *wh = &hdata->wh; + struct gvp11_scsiregs *regs = hdata->regs; unsigned short cntr = GVP11_DMAC_INT_ENABLE; unsigned long addr = virt_to_bus(cmd->SCp.ptr); int bank_mask; static int scsi_alloc_out_of_range = 0; /* use bounce buffer if the physical address is bad */ - if (addr & hdata->dma_xfer_mask) { - hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; + if (addr & wh->dma_xfer_mask) { + wh->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; if (!scsi_alloc_out_of_range) { - hdata->dma_bounce_buffer = - kmalloc(hdata->dma_bounce_len, GFP_KERNEL); - hdata->dma_buffer_pool = BUF_SCSI_ALLOCED; + wh->dma_bounce_buffer = + kmalloc(wh->dma_bounce_len, GFP_KERNEL); + wh->dma_buffer_pool = BUF_SCSI_ALLOCED; } if (scsi_alloc_out_of_range || - !hdata->dma_bounce_buffer) { - hdata->dma_bounce_buffer = - amiga_chip_alloc(hdata->dma_bounce_len, + !wh->dma_bounce_buffer) { + wh->dma_bounce_buffer = + amiga_chip_alloc(wh->dma_bounce_len, "GVP II SCSI Bounce Buffer"); - if (!hdata->dma_bounce_buffer) { - hdata->dma_bounce_len = 0; + if (!wh->dma_bounce_buffer) { + wh->dma_bounce_len = 0; return 1; } - hdata->dma_buffer_pool = BUF_CHIP_ALLOCED; + wh->dma_buffer_pool = BUF_CHIP_ALLOCED; } /* check if the address of the bounce buffer is OK */ - addr = virt_to_bus(hdata->dma_bounce_buffer); + addr = virt_to_bus(wh->dma_bounce_buffer); - if (addr & hdata->dma_xfer_mask) { + if (addr & wh->dma_xfer_mask) { /* fall back to Chip RAM if address out of range */ - if (hdata->dma_buffer_pool == BUF_SCSI_ALLOCED) { - kfree(hdata->dma_bounce_buffer); + if (wh->dma_buffer_pool == BUF_SCSI_ALLOCED) { + kfree(wh->dma_bounce_buffer); scsi_alloc_out_of_range = 1; } else { - amiga_chip_free(hdata->dma_bounce_buffer); + amiga_chip_free(wh->dma_bounce_buffer); } - hdata->dma_bounce_buffer = - amiga_chip_alloc(hdata->dma_bounce_len, + wh->dma_bounce_buffer = + amiga_chip_alloc(wh->dma_bounce_len, "GVP II SCSI Bounce Buffer"); - if (!hdata->dma_bounce_buffer) { - hdata->dma_bounce_len = 0; + if (!wh->dma_bounce_buffer) { + wh->dma_bounce_len = 0; return 1; } - addr = virt_to_bus(hdata->dma_bounce_buffer); - hdata->dma_buffer_pool = BUF_CHIP_ALLOCED; + addr = virt_to_bus(wh->dma_bounce_buffer); + wh->dma_buffer_pool = BUF_CHIP_ALLOCED; } if (!dir_in) { /* copy to bounce buffer for a write */ - memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr, + memcpy(wh->dma_bounce_buffer, cmd->SCp.ptr, cmd->SCp.this_residual); } } @@ -111,7 +117,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) if (!dir_in) cntr |= GVP11_DMAC_DIR_WRITE; - hdata->dma_dir = dir_in; + wh->dma_dir = dir_in; regs->CNTR = cntr; /* setup DMA *physical* address */ @@ -125,7 +131,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cache_push(addr, cmd->SCp.this_residual); } - bank_mask = (~hdata->dma_xfer_mask >> 18) & 0x01c0; + bank_mask = (~wh->dma_xfer_mask >> 18) & 0x01c0; if (bank_mask) regs->BANK = bank_mask & (addr >> 18); @@ -139,8 +145,9 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { - struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base); - struct WD33C93_hostdata *hdata = shost_priv(instance); + struct gvp11_hostdata *hdata = shost_priv(instance); + struct WD33C93_hostdata *wh = &hdata->wh; + struct gvp11_scsiregs *regs = hdata->regs; /* stop DMA */ regs->SP_DMA = 1; @@ -148,18 +155,18 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, regs->CNTR = GVP11_DMAC_INT_ENABLE; /* copy from a bounce buffer, if necessary */ - if (status && hdata->dma_bounce_buffer) { - if (hdata->dma_dir && SCpnt) - memcpy(SCpnt->SCp.ptr, hdata->dma_bounce_buffer, + if (status && wh->dma_bounce_buffer) { + if (wh->dma_dir && SCpnt) + memcpy(SCpnt->SCp.ptr, wh->dma_bounce_buffer, SCpnt->SCp.this_residual); - if (hdata->dma_buffer_pool == BUF_SCSI_ALLOCED) - kfree(hdata->dma_bounce_buffer); + if (wh->dma_buffer_pool == BUF_SCSI_ALLOCED) + kfree(wh->dma_bounce_buffer); else - amiga_chip_free(hdata->dma_bounce_buffer); + amiga_chip_free(wh->dma_bounce_buffer); - hdata->dma_bounce_buffer = NULL; - hdata->dma_bounce_len = 0; + wh->dma_bounce_buffer = NULL; + wh->dma_bounce_len = 0; } } @@ -284,7 +291,7 @@ static int __devinit gvp11_probe(struct zorro_dev *z, int error; unsigned int epc; unsigned int default_dma_xfer_mask; - struct WD33C93_hostdata *hdata; + struct gvp11_hostdata *hdata; struct gvp11_scsiregs *regs; wd33c93_regs wdregs; @@ -309,13 +316,12 @@ static int __devinit gvp11_probe(struct zorro_dev *z, goto fail_check_or_alloc; instance = scsi_host_alloc(&gvp11_scsi_template, - sizeof(struct WD33C93_hostdata)); + sizeof(struct gvp11_hostdata)); if (!instance) { error = -ENOMEM; goto fail_check_or_alloc; } - instance->base = (unsigned long)regs; instance->irq = IRQ_AMIGA_PORTS; instance->unique_id = z->slotaddr; @@ -332,13 +338,14 @@ static int __devinit gvp11_probe(struct zorro_dev *z, hdata = shost_priv(instance); if (gvp11_xfer_mask) - hdata->dma_xfer_mask = gvp11_xfer_mask; + hdata->wh.dma_xfer_mask = gvp11_xfer_mask; else - hdata->dma_xfer_mask = default_dma_xfer_mask; + hdata->wh.dma_xfer_mask = default_dma_xfer_mask; - hdata->no_sync = 0xff; - hdata->fast = 0; - hdata->dma_mode = CTRL_DMA; + hdata->wh.no_sync = 0xff; + hdata->wh.fast = 0; + hdata->wh.dma_mode = CTRL_DMA; + hdata->regs = regs; /* * Check for 14MHz SCSI clock @@ -375,9 +382,9 @@ fail_check_or_alloc: static void __devexit gvp11_remove(struct zorro_dev *z) { struct Scsi_Host *instance = zorro_get_drvdata(z); - struct gvp11_scsiregs *regs = (struct gvp11_scsiregs *)(instance->base); + struct gvp11_hostdata *hdata = shost_priv(instance); - regs->CNTR = 0; + hdata->regs->CNTR = 0; scsi_remove_host(instance); free_irq(IRQ_AMIGA_PORTS, instance); scsi_host_put(instance); -- 1.6.0.4 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro 2010-04-23 8:38 ` Geert Uytterhoeven @ 2010-04-23 8:40 ` Geert Uytterhoeven 2010-04-23 10:15 ` [PATCH] SCSI: sgiwd93: remove use of legacy base field of host struct Ralf Baechle 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-04-23 8:40 UTC (permalink / raw) To: Christoph Hellwig Cc: James E.J. Bottomley, linux-m68k, linux-scsi, Ralf Baechle On Fri, Apr 23, 2010 at 10:38, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Fri, Apr 23, 2010 at 10:37, Geert Uytterhoeven <geert@linux-m68k.org> wrote: >> On Mon, Apr 5, 2010 at 21:42, Geert Uytterhoeven <geert@linux-m68k.org> wrote: >>> On Mon, Apr 5, 2010 at 08:25, Christoph Hellwig <hch@infradead.org> wrote: >>>> Instead of abusing the ScsiHost base field I'd prefer if you stick >>> >>> I wouldn't call it abuse: it's a (MM)IO base address anyway. >>> But I see that field was indeed marked `legacy crap' in an otherwise >>> innocent looking >>> commit to split the SCSI include files... by you ;-) >>> >>>> a properly typed pointer into the device specific host data. >>> >>> You mean shost_priv()? That field already contains a pointer to the >>> struct WD33C93_hostdata. >>> >>> But I'll create a new a2091_hostdata struct that contains both the >>> WD33C93_hostdata and the a2091_scsiregs pointer (and do the same >>> for gvp11.c and a3000.c). It's a bit similar to what sgiwd93.c does, albeit that >>> one also uses the legacy base field. >> >> As I want to avoid introducing bugs by respinning the complicated >> parts (the zorro >> driver and platform driver conversion patches), I made this change on >> top of the 2 >> whole patch series. A3000 part (on top of today's Amiga platform conversion patch series) >From 6dca8f7534f9db10613b7034b895c0f56a433d07 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert@linux-m68k.org> Date: Mon, 12 Apr 2010 21:55:15 +0200 Subject: [PATCH] m68k/scsi: a3000 - Do not use legacy Scsi_Host.base Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> --- drivers/scsi/a3000.c | 76 +++++++++++++++++++++++++++----------------------- 1 files changed, 41 insertions(+), 35 deletions(-) diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index 7f09d89..d946802 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -17,11 +17,16 @@ #include "a3000.h" +struct a3000_hostdata { + struct WD33C93_hostdata wh; + struct a3000_scsiregs *regs; +}; + static irqreturn_t a3000_intr(int irq, void *data) { struct Scsi_Host *instance = data; - struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); - unsigned int status = regs->ISTR; + struct a3000_hostdata *hdata = shost_priv(instance); + unsigned int status = hdata->regs->ISTR; unsigned long flags; if (!(status & ISTR_INT_P)) @@ -39,8 +44,9 @@ static irqreturn_t a3000_intr(int irq, void *data) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { struct Scsi_Host *instance = cmd->device->host; - struct WD33C93_hostdata *hdata = shost_priv(instance); - struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); + struct a3000_hostdata *hdata = shost_priv(instance); + struct WD33C93_hostdata *wh = &hdata->wh; + struct a3000_scsiregs *regs = hdata->regs; unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); @@ -51,23 +57,23 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) * buffer */ if (addr & A3000_XFER_MASK) { - hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; - hdata->dma_bounce_buffer = kmalloc(hdata->dma_bounce_len, - GFP_KERNEL); + wh->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; + wh->dma_bounce_buffer = kmalloc(wh->dma_bounce_len, + GFP_KERNEL); /* can't allocate memory; use PIO */ - if (!hdata->dma_bounce_buffer) { - hdata->dma_bounce_len = 0; + if (!wh->dma_bounce_buffer) { + wh->dma_bounce_len = 0; return 1; } if (!dir_in) { /* copy to bounce buffer for a write */ - memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr, + memcpy(wh->dma_bounce_buffer, cmd->SCp.ptr, cmd->SCp.this_residual); } - addr = virt_to_bus(hdata->dma_bounce_buffer); + addr = virt_to_bus(wh->dma_bounce_buffer); } /* setup dma direction */ @@ -75,7 +81,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cntr |= CNTR_DDIR; /* remember direction */ - hdata->dma_dir = dir_in; + wh->dma_dir = dir_in; regs->CNTR = cntr; @@ -102,20 +108,21 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { - struct WD33C93_hostdata *hdata = shost_priv(instance); - struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); + struct a3000_hostdata *hdata = shost_priv(instance); + struct WD33C93_hostdata *wh = &hdata->wh; + struct a3000_scsiregs *regs = hdata->regs; /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; - if (!hdata->dma_dir) + if (!wh->dma_dir) cntr |= CNTR_DDIR; regs->CNTR = cntr; mb(); /* make sure CNTR is updated before next IO */ /* flush if we were reading */ - if (hdata->dma_dir) { + if (wh->dma_dir) { regs->FLUSH = 1; mb(); /* don't allow prefetch */ while (!(regs->ISTR & ISTR_FE_FLG)) @@ -138,19 +145,18 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, mb(); /* make sure CNTR is updated before next IO */ /* copy from a bounce buffer, if necessary */ - if (status && hdata->dma_bounce_buffer) { + if (status && wh->dma_bounce_buffer) { if (SCpnt) { - if (hdata->dma_dir && SCpnt) - memcpy(SCpnt->SCp.ptr, - hdata->dma_bounce_buffer, + if (wh->dma_dir && SCpnt) + memcpy(SCpnt->SCp.ptr, wh->dma_bounce_buffer, SCpnt->SCp.this_residual); - kfree(hdata->dma_bounce_buffer); - hdata->dma_bounce_buffer = NULL; - hdata->dma_bounce_len = 0; + kfree(wh->dma_bounce_buffer); + wh->dma_bounce_buffer = NULL; + wh->dma_bounce_len = 0; } else { - kfree(hdata->dma_bounce_buffer); - hdata->dma_bounce_buffer = NULL; - hdata->dma_bounce_len = 0; + kfree(wh->dma_bounce_buffer); + wh->dma_bounce_buffer = NULL; + wh->dma_bounce_len = 0; } } } @@ -194,7 +200,7 @@ static int __init amiga_a3000_scsi_probe(struct platform_device *pdev) int error; struct a3000_scsiregs *regs; wd33c93_regs wdregs; - struct WD33C93_hostdata *hdata; + struct a3000_hostdata *hdata; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) @@ -204,25 +210,25 @@ static int __init amiga_a3000_scsi_probe(struct platform_device *pdev) return -EBUSY; instance = scsi_host_alloc(&amiga_a3000_scsi_template, - sizeof(struct WD33C93_hostdata)); + sizeof(struct a3000_hostdata)); if (!instance) { error = -ENOMEM; goto fail_alloc; } - instance->base = ZTWO_VADDR(res->start); instance->irq = IRQ_AMIGA_PORTS; - regs = (struct a3000_scsiregs *)(instance->base); + regs = (struct a3000_scsiregs *)ZTWO_VADDR(res->start); regs->DAWR = DAWR_A3000; wdregs.SASR = ®s->SASR; wdregs.SCMD = ®s->SCMD; hdata = shost_priv(instance); - hdata->no_sync = 0xff; - hdata->fast = 0; - hdata->dma_mode = CTRL_DMA; + hdata->wh.no_sync = 0xff; + hdata->wh.fast = 0; + hdata->wh.dma_mode = CTRL_DMA; + hdata->regs = regs; wd33c93_init(instance, wdregs, dma_setup, dma_stop, WD33C93_FS_12_15); error = request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, @@ -253,10 +259,10 @@ fail_alloc: static int __exit amiga_a3000_scsi_remove(struct platform_device *pdev) { struct Scsi_Host *instance = platform_get_drvdata(pdev); - struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); + struct a3000_hostdata *hdata = shost_priv(instance); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - regs->CNTR = 0; + hdata->regs->CNTR = 0; scsi_remove_host(instance); free_irq(IRQ_AMIGA_PORTS, instance); scsi_host_put(instance); -- 1.6.0.4 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH] SCSI: sgiwd93: remove use of legacy base field of host struct 2010-04-23 8:40 ` Geert Uytterhoeven @ 2010-04-23 10:15 ` Ralf Baechle 2010-04-23 10:26 ` [PATCH] SCSI: sgiwd93: Convert to use shost_priv() Ralf Baechle 0 siblings, 1 reply; 32+ messages in thread From: Ralf Baechle @ 2010-04-23 10:15 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Christoph Hellwig, James E.J. Bottomley, linux-m68k, linux-scsi --- Build tested only - I don't have a test system at hand atm. drivers/scsi/sgiwd93.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c index fef0e3c..1b24e8d 100644 --- a/drivers/scsi/sgiwd93.c +++ b/drivers/scsi/sgiwd93.c @@ -36,6 +36,7 @@ struct ip22_hostdata { dma_addr_t dma; void *cpu; struct device *dev; + struct hpc3_scsiregs *hregs; }; #define host_to_hostdata(host) ((struct ip22_hostdata *)((host)->hostdata)) @@ -103,8 +104,7 @@ void fill_hpc_entries(struct ip22_hostdata *hd, struct scsi_cmnd *cmd, int din) static int dma_setup(struct scsi_cmnd *cmd, int datainp) { struct ip22_hostdata *hdata = host_to_hostdata(cmd->device->host); - struct hpc3_scsiregs *hregs = - (struct hpc3_scsiregs *) cmd->device->host->base; + struct hpc3_scsiregs *hregs = hdata->hregs; pr_debug("dma_setup: datainp<%d> hcp<%p> ", datainp, hdata->cpu); @@ -137,7 +137,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { struct ip22_hostdata *hdata = host_to_hostdata(instance); - struct hpc3_scsiregs *hregs; + struct hpc3_scsiregs *hregs = hdata->hregs; if (!SCpnt) return; @@ -145,8 +145,6 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, if (SCpnt->SCp.ptr == NULL || SCpnt->SCp.this_residual == 0) return; - hregs = (struct hpc3_scsiregs *) SCpnt->device->host->base; - pr_debug("dma_stop: status<%d> ", status); /* First stop the HPC and flush it's FIFO. */ @@ -244,10 +242,10 @@ static int __devinit sgiwd93_probe(struct platform_device *pdev) goto out; } - host->base = (unsigned long) hregs; host->irq = irq; hdata = host_to_hostdata(host); + hdata->hregs = hregs; hdata->dev = &pdev->dev; hdata->cpu = dma_alloc_noncoherent(&pdev->dev, HPC_DMA_SIZE, &hdata->dma, GFP_KERNEL); ^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH] SCSI: sgiwd93: Convert to use shost_priv() 2010-04-23 10:15 ` [PATCH] SCSI: sgiwd93: remove use of legacy base field of host struct Ralf Baechle @ 2010-04-23 10:26 ` Ralf Baechle 0 siblings, 0 replies; 32+ messages in thread From: Ralf Baechle @ 2010-04-23 10:26 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Christoph Hellwig, James E.J. Bottomley, linux-m68k, linux-scsi The driver had its own similar macro and still one open-coded reference to ->hostdata. Use shost_priv() everywhere for consistency. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> --- Build tested only - I don't have a test system at hand atm. The previous patch was missing a Signed-off-by: line, feel free to add it. drivers/scsi/sgiwd93.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c index 1b24e8d..e9204fb 100644 --- a/drivers/scsi/sgiwd93.c +++ b/drivers/scsi/sgiwd93.c @@ -39,8 +39,6 @@ struct ip22_hostdata { struct hpc3_scsiregs *hregs; }; -#define host_to_hostdata(host) ((struct ip22_hostdata *)((host)->hostdata)) - struct hpc_chunk { struct hpc_dma_desc desc; u32 _padding; /* align to quadword boundary */ @@ -103,7 +101,7 @@ void fill_hpc_entries(struct ip22_hostdata *hd, struct scsi_cmnd *cmd, int din) static int dma_setup(struct scsi_cmnd *cmd, int datainp) { - struct ip22_hostdata *hdata = host_to_hostdata(cmd->device->host); + struct ip22_hostdata *hdata = shost_priv(cmd->device->host); struct hpc3_scsiregs *hregs = hdata->hregs; pr_debug("dma_setup: datainp<%d> hcp<%p> ", datainp, hdata->cpu); @@ -136,7 +134,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int datainp) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { - struct ip22_hostdata *hdata = host_to_hostdata(instance); + struct ip22_hostdata *hdata = shost_priv(instance); struct hpc3_scsiregs *hregs = hdata->hregs; if (!SCpnt) @@ -244,7 +242,7 @@ static int __devinit sgiwd93_probe(struct platform_device *pdev) host->irq = irq; - hdata = host_to_hostdata(host); + hdata = shost_priv(host); hdata->hregs = hregs; hdata->dev = &pdev->dev; hdata->cpu = dma_alloc_noncoherent(&pdev->dev, HPC_DMA_SIZE, @@ -298,7 +296,7 @@ out: static int __exit sgiwd93_remove(struct platform_device *pdev) { struct Scsi_Host *host = platform_get_drvdata(pdev); - struct ip22_hostdata *hdata = (struct ip22_hostdata *) host->hostdata; + struct ip22_hostdata *hdata = shost_priv(host); struct sgiwd93_platform_data *pd = pdev->dev.platform_data; scsi_remove_host(host); ^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro 2010-04-23 8:37 ` Geert Uytterhoeven 2010-04-23 8:38 ` Geert Uytterhoeven @ 2010-05-02 20:05 ` James Bottomley 2010-05-03 19:25 ` Geert Uytterhoeven 1 sibling, 1 reply; 32+ messages in thread From: James Bottomley @ 2010-05-02 20:05 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Christoph Hellwig, linux-m68k, linux-scsi, Ralf Baechle On Fri, 2010-04-23 at 10:37 +0200, Geert Uytterhoeven wrote: > On Mon, Apr 5, 2010 at 21:42, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > > On Mon, Apr 5, 2010 at 08:25, Christoph Hellwig <hch@infradead.org> wrote: > >> Instead of abusing the ScsiHost base field I'd prefer if you stick > > > > I wouldn't call it abuse: it's a (MM)IO base address anyway. > > But I see that field was indeed marked `legacy crap' in an otherwise > > innocent looking > > commit to split the SCSI include files... by you ;-) > > > >> a properly typed pointer into the device specific host data. > > > > You mean shost_priv()? That field already contains a pointer to the > > struct WD33C93_hostdata. > > > > But I'll create a new a2091_hostdata struct that contains both the > > WD33C93_hostdata and the a2091_scsiregs pointer (and do the same > > for gvp11.c and a3000.c). It's a bit similar to what sgiwd93.c does, albeit that > > one also uses the legacy base field. > > As I want to avoid introducing bugs by respinning the complicated > parts (the zorro > driver and platform driver conversion patches), I made this change on > top of the 2 > whole patch series. > > A2091 part: I've applied up to 10/21 which should make it easier, but this patch refuses to apply: patch: **** malformed patch at line 230: struct scsi_cmnd *SCpnt, could you respin the remaining patches so they'll actually apply? Thanks, James ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro 2010-05-02 20:05 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro James Bottomley @ 2010-05-03 19:25 ` Geert Uytterhoeven 2010-05-13 19:41 ` Geert Uytterhoeven 0 siblings, 1 reply; 32+ messages in thread From: Geert Uytterhoeven @ 2010-05-03 19:25 UTC (permalink / raw) To: James Bottomley; +Cc: Christoph Hellwig, linux-m68k, linux-scsi, Ralf Baechle On Sun, May 2, 2010 at 22:05, James Bottomley <James.Bottomley@suse.de> wrote: > On Fri, 2010-04-23 at 10:37 +0200, Geert Uytterhoeven wrote: >> On Mon, Apr 5, 2010 at 21:42, Geert Uytterhoeven <geert@linux-m68k.org> wrote: >> > On Mon, Apr 5, 2010 at 08:25, Christoph Hellwig <hch@infradead.org> wrote: >> >> Instead of abusing the ScsiHost base field I'd prefer if you stick >> > >> > I wouldn't call it abuse: it's a (MM)IO base address anyway. >> > But I see that field was indeed marked `legacy crap' in an otherwise >> > innocent looking >> > commit to split the SCSI include files... by you ;-) >> > >> >> a properly typed pointer into the device specific host data. >> > >> > You mean shost_priv()? That field already contains a pointer to the >> > struct WD33C93_hostdata. >> > >> > But I'll create a new a2091_hostdata struct that contains both the >> > WD33C93_hostdata and the a2091_scsiregs pointer (and do the same >> > for gvp11.c and a3000.c). It's a bit similar to what sgiwd93.c does, albeit that >> > one also uses the legacy base field. >> >> As I want to avoid introducing bugs by respinning the complicated >> parts (the zorro >> driver and platform driver conversion patches), I made this change on >> top of the 2 >> whole patch series. >> >> A2091 part: > > I've applied up to 10/21 which should make it easier, but this patch Thanks a lot! (I saw they showed up in linux-next, which is good!) > refuses to apply: > > patch: **** malformed patch at line 230: struct scsi_cmnd *SCpnt, Bummer. I sent those manually from gmail using copy-'n-paste from gedit, which _used_ to work fine w.r.t. whitespace and line breaks. Oh well, they broke it :-( > could you respin the remaining patches so they'll actually apply? The remaining 11-21/21 from the original series had been sent using git-send-email, so they should apply fine. I'll resend the other 3 using git-send-email, too. The first 2 should apply fine on top of the series of 21. The third won't apply as it depends on the Amiga platform rework, but we can sort that out later. Or I can just take care of it myself, if you approve? Thanks again! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro 2010-05-03 19:25 ` Geert Uytterhoeven @ 2010-05-13 19:41 ` Geert Uytterhoeven 0 siblings, 0 replies; 32+ messages in thread From: Geert Uytterhoeven @ 2010-05-13 19:41 UTC (permalink / raw) To: James Bottomley; +Cc: Christoph Hellwig, linux-m68k, linux-scsi, Ralf Baechle On Mon, May 3, 2010 at 21:25, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Sun, May 2, 2010 at 22:05, James Bottomley <James.Bottomley@suse.de> wrote: >> On Fri, 2010-04-23 at 10:37 +0200, Geert Uytterhoeven wrote: >>> On Mon, Apr 5, 2010 at 21:42, Geert Uytterhoeven <geert@linux-m68k.org> wrote: >>> > On Mon, Apr 5, 2010 at 08:25, Christoph Hellwig <hch@infradead.org> wrote: >>> >> Instead of abusing the ScsiHost base field I'd prefer if you stick >>> > >>> > I wouldn't call it abuse: it's a (MM)IO base address anyway. >>> > But I see that field was indeed marked `legacy crap' in an otherwise >>> > innocent looking >>> > commit to split the SCSI include files... by you ;-) >>> > >>> >> a properly typed pointer into the device specific host data. >>> > >>> > You mean shost_priv()? That field already contains a pointer to the >>> > struct WD33C93_hostdata. >>> > >>> > But I'll create a new a2091_hostdata struct that contains both the >>> > WD33C93_hostdata and the a2091_scsiregs pointer (and do the same >>> > for gvp11.c and a3000.c). It's a bit similar to what sgiwd93.c does, albeit that >>> > one also uses the legacy base field. >>> >>> As I want to avoid introducing bugs by respinning the complicated >>> parts (the zorro >>> driver and platform driver conversion patches), I made this change on >>> top of the 2 >>> whole patch series. >>> >>> A2091 part: >> >> I've applied up to 10/21 which should make it easier, but this patch > > Thanks a lot! (I saw they showed up in linux-next, which is good!) > >> refuses to apply: >> >> patch: **** malformed patch at line 230: struct scsi_cmnd *SCpnt, > > Bummer. I sent those manually from gmail using copy-'n-paste from > gedit, which _used_ > to work fine w.r.t. whitespace and line breaks. Oh well, they broke it :-( > >> could you respin the remaining patches so they'll actually apply? > > The remaining 11-21/21 from the original series had been sent using > git-send-email, so they should apply fine. > > I'll resend the other 3 using git-send-email, too. The first 2 should > apply fine on top > of the series of 21. > The third won't apply as it depends on the Amiga platform rework, but we can > sort that out later. Or I can just take care of it myself, if you approve? For your convenience, I also put all of them (except for the third one) in a for-scsi branch (you already applied the first 10 commits on that branch): The following changes since commit cea0d767c29669bf89f86e4aee46ef462d2ebae8: Linus Torvalds (1): Merge branch 'hwmon-for-linus' of git://git.kernel.org/.../jdelvare/staging are available in the git repository at: master.kernel.org:/pub/scm/linux/kernel/git/geert/linux-m68k.git for-scsi Geert Uytterhoeven (23): scsi: wd33c93 - Kill empty wd33c93_release() m68k/scsi: a2091 - Reindentation m68k/scsi: gvp11 - Reindentation m68k/scsi: mvme147 - Reindentation m68k/scsi: a3000 - Reindentation m68k/scsi: a2091 - Use shost_priv() and kill ugly HDATA() macro m68k/scsi: gvp11 - Use shost_priv() and kill ugly HDATA() macro m68k/scsi: mvme147 - Use shost_priv() and kill ugly HDATA() macro m68k/scsi: a3000 - Use shost_priv() and kill ugly HDATA() macro m68k/scsi: a2091 - Kill ugly DMA() macro m68k/scsi: gvp11 - Kill ugly DMA() macro m68k/scsi: a3000 - Kill ugly DMA() macro m68k/scsi: mvme147 - Kill static global mvme147_host m68k/scsi: a3000 - Kill static global a3000_host m68k/scsi: gvp11 - Extract check_wd33c93() m68k/scsi: a2091 - Kill a2091_scsiregs typedef m68k/scsi: gvp11 - Kill gvp11_scsiregs typedef m68k/scsi: a3000 - Kill a3000_scsiregs typedef m68k/scsi: mvme147 - Kill obsolete HOSTS_C logic m68k: amiga - A2091/A590 SCSI zorro_driver conversion m68k: amiga - GVP Series II SCSI zorro_driver conversion m68k/scsi: a2091 - Do not use legacy Scsi_Host.base m68k/scsi: gvp11 - Do not use legacy Scsi_Host.base drivers/scsi/a2091.c | 398 ++++++++++++++++++--------------- drivers/scsi/a2091.h | 46 ++-- drivers/scsi/a3000.c | 301 +++++++++++++------------ drivers/scsi/a3000.h | 50 ++-- drivers/scsi/gvp11.c | 582 +++++++++++++++++++++++++----------------------- drivers/scsi/gvp11.h | 49 ++--- drivers/scsi/mvme147.c | 178 ++++++++-------- drivers/scsi/mvme147.h | 4 +- drivers/scsi/wd33c93.c | 6 - drivers/scsi/wd33c93.h | 1 - 10 files changed, 836 insertions(+), 779 deletions(-) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2010-05-13 19:41 UTC | newest] Thread overview: 32+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-04-04 9:00 [PATCH 0/21] m68k/scsi: wd33c93 driver cleanups Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 01/21] scsi: wd33c93 - Kill empty wd33c93_release() Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 02/21] m68k/scsi: a2091 - Reindentation Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 03/21] m68k/scsi: gvp11 " Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 04/21] m68k/scsi: mvme147 " Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 05/21] m68k/scsi: a3000 " Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 06/21] m68k/scsi: a2091 - Use shost_priv() and kill ugly HDATA() macro Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 07/21] m68k/scsi: gvp11 " Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 08/21] m68k/scsi: mvme147 " Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 09/21] m68k/scsi: a3000 " Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 11/21] m68k/scsi: gvp11 " Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 12/21] m68k/scsi: a3000 " Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 13/21] m68k/scsi: mvme147 - Kill static global mvme147_host Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 14/21] m68k/scsi: a3000 - Kill static global a3000_host Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 15/21] m68k/scsi: gvp11 - Extract check_wd33c93() Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 16/21] m68k/scsi: a2091 - Kill a2091_scsiregs typedef Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 17/21] m68k/scsi: gvp11 - Kill gvp11_scsiregs typedef Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 18/21] m68k/scsi: a3000 - Kill a3000_scsiregs typedef Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 19/21] m68k/scsi: mvme147 - Kill obsolete HOSTS_C logic Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 20/21] m68k: amiga - A2091/A590 SCSI zorro_driver conversion Geert Uytterhoeven 2010-04-04 9:00 ` [PATCH 21/21] m68k: amiga - GVP Series II " Geert Uytterhoeven 2010-04-05 6:25 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro Christoph Hellwig 2010-04-05 19:42 ` Geert Uytterhoeven 2010-04-23 8:37 ` Geert Uytterhoeven 2010-04-23 8:38 ` Geert Uytterhoeven 2010-04-23 8:40 ` Geert Uytterhoeven 2010-04-23 10:15 ` [PATCH] SCSI: sgiwd93: remove use of legacy base field of host struct Ralf Baechle 2010-04-23 10:26 ` [PATCH] SCSI: sgiwd93: Convert to use shost_priv() Ralf Baechle 2010-05-02 20:05 ` [PATCH 10/21] m68k/scsi: a2091 - Kill ugly DMA() macro James Bottomley 2010-05-03 19:25 ` Geert Uytterhoeven 2010-05-13 19:41 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).