[SCSI] gvp11: Reindentation
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
parent
09bc85b08c
commit
bb17b7871b
@ -19,12 +19,13 @@
|
||||
#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)
|
||||
static irqreturn_t gvp11_intr(int irq, void *_instance)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned int status;
|
||||
@ -42,7 +43,7 @@ static irqreturn_t gvp11_intr (int irq, void *_instance)
|
||||
|
||||
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];
|
||||
}
|
||||
@ -55,15 +56,16 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
|
||||
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(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 ) {
|
||||
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;
|
||||
kmalloc(HDATA(cmd->device->host)->dma_bounce_len,
|
||||
GFP_KERNEL);
|
||||
HDATA(cmd->device->host)->dma_buffer_pool =
|
||||
BUF_SCSI_ALLOCED;
|
||||
}
|
||||
|
||||
if (scsi_alloc_out_of_range ||
|
||||
@ -72,13 +74,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
|
||||
amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len,
|
||||
"GVP II SCSI Bounce Buffer");
|
||||
|
||||
if(!HDATA(cmd->device->host)->dma_bounce_buffer)
|
||||
{
|
||||
if (!HDATA(cmd->device->host)->dma_bounce_buffer) {
|
||||
HDATA(cmd->device->host)->dma_bounce_len = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
HDATA(cmd->device->host)->dma_buffer_pool = BUF_CHIP_ALLOCED;
|
||||
HDATA(cmd->device->host)->dma_buffer_pool =
|
||||
BUF_CHIP_ALLOCED;
|
||||
}
|
||||
|
||||
/* check if the address of the bounce buffer is OK */
|
||||
@ -86,30 +88,31 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
|
||||
|
||||
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);
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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;
|
||||
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,
|
||||
memcpy(HDATA(cmd->device->host)->dma_bounce_buffer,
|
||||
cmd->SCp.ptr, cmd->SCp.this_residual);
|
||||
}
|
||||
}
|
||||
@ -124,12 +127,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
|
||||
/* setup DMA *physical* address */
|
||||
DMA(cmd->device->host)->ACR = addr;
|
||||
|
||||
if (dir_in)
|
||||
if (dir_in) {
|
||||
/* invalidate any cache */
|
||||
cache_clear (addr, cmd->SCp.this_residual);
|
||||
else
|
||||
cache_clear(addr, cmd->SCp.this_residual);
|
||||
} else {
|
||||
/* push any dirty cache */
|
||||
cache_push (addr, cmd->SCp.this_residual);
|
||||
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);
|
||||
@ -152,12 +156,12 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
|
||||
/* copy from a bounce buffer, if necessary */
|
||||
if (status && HDATA(instance)->dma_bounce_buffer) {
|
||||
if (HDATA(instance)->dma_dir && SCpnt)
|
||||
memcpy (SCpnt->SCp.ptr,
|
||||
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);
|
||||
kfree(HDATA(instance)->dma_bounce_buffer);
|
||||
else
|
||||
amiga_chip_free(HDATA(instance)->dma_bounce_buffer);
|
||||
|
||||
@ -216,7 +220,7 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
|
||||
* 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)
|
||||
if (z->resource.end - z->resource.start != 0xffff)
|
||||
continue;
|
||||
|
||||
address = z->resource.start;
|
||||
@ -257,8 +261,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
|
||||
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
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
@ -295,8 +299,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
|
||||
goto release;
|
||||
#endif
|
||||
|
||||
instance = scsi_register (tpnt, sizeof (struct WD33C93_hostdata));
|
||||
if(instance == NULL)
|
||||
instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
|
||||
if (instance == NULL)
|
||||
goto release;
|
||||
instance->base = ZTWO_VADDR(address);
|
||||
instance->irq = IRQ_AMIGA_PORTS;
|
||||
@ -307,11 +311,11 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
|
||||
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) ;
|
||||
while (DMA(instance)->CNTR & GVP11_DMAC_BUSY)
|
||||
;
|
||||
DMA(instance)->CNTR = 0;
|
||||
|
||||
DMA(instance)->BANK = 0;
|
||||
@ -330,8 +334,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
|
||||
(epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10
|
||||
: WD33C93_FS_12_15);
|
||||
|
||||
if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, "GVP11 SCSI",
|
||||
instance))
|
||||
if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED,
|
||||
"GVP11 SCSI", instance))
|
||||
goto unregister;
|
||||
DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE;
|
||||
num_gvp11++;
|
||||
|
Loading…
Reference in New Issue
Block a user