Commit df961b48 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] m68k: driver updates [6/20]

- kdev_t fixes
- bio fixes
- other cleanups and compile fixes
parent 3c3403c5
......@@ -206,7 +206,7 @@ static DECLARE_WAIT_QUEUE_HEAD(ms_wait);
/* Prevent "aliased" accesses. */
static int fd_ref[4] = { 0,0,0,0 };
static int fd_device[4] = { 0,0,0,0 };
static kdev_t fd_device[4] = { NODEV, NODEV, NODEV, NODEV };
/*
* Current device number. Taken either from the block header or from the
......@@ -1393,13 +1393,10 @@ static void redo_fd_request(void)
return;
}
if (MAJOR(CURRENT->rq_dev) != MAJOR_NR)
if (major(CURRENT->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed");
if (CURRENT->bh && !buffer_locked(CURRENT->bh))
panic(DEVICE_NAME ": block not locked");
device = MINOR(CURRENT_DEVICE);
device = minor(CURRENT_DEVICE);
if (device < 8) {
/* manual selection */
drive = device & 3;
......@@ -1435,7 +1432,7 @@ static void redo_fd_request(void)
"0x%08lx\n", track, sector, data);
#endif
if ((CURRENT->cmd != READ) && (CURRENT->cmd != WRITE)) {
if ((rq_data_dir(CURRENT) != READ) && (rq_data_dir(CURRENT) != WRITE)) {
printk(KERN_WARNING "do_fd_request: unknown command\n");
end_request(0);
goto repeat;
......@@ -1445,7 +1442,7 @@ static void redo_fd_request(void)
goto repeat;
}
switch (CURRENT->cmd) {
switch (rq_data_dir(CURRENT)) {
case READ:
memcpy(data, unit[drive].trackbuf + sector * 512, 512);
break;
......@@ -1490,9 +1487,8 @@ static void do_fd_request(request_queue_t * q)
static int fd_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long param)
{
int drive = inode->i_rdev & 3;
int drive = minor(inode->i_rdev) & 3;
static struct floppy_struct getprm;
struct super_block * sb;
switch(cmd){
case HDIO_GETGEO:
......@@ -1622,15 +1618,15 @@ static void fd_probe(int dev)
static int floppy_open(struct inode *inode, struct file *filp)
{
int drive;
int old_dev;
kdev_t old_dev;
int system;
unsigned long flags;
drive = MINOR(inode->i_rdev) & 3;
drive = minor(inode->i_rdev) & 3;
old_dev = fd_device[drive];
if (fd_ref[drive])
if (old_dev != inode->i_rdev)
if (!kdev_same(old_dev, inode->i_rdev))
return -EBUSY;
if (unit[drive].type->code == FD_NODRIVE)
......@@ -1662,14 +1658,14 @@ static int floppy_open(struct inode *inode, struct file *filp)
#endif
restore_flags(flags);
if (old_dev && old_dev != inode->i_rdev)
if (!kdev_same(old_dev, NODEV) && !kdev_same(old_dev, inode->i_rdev))
invalidate_buffers(old_dev);
system=(inode->i_rdev & 4)>>2;
system=(minor(inode->i_rdev) & 4)>>2;
unit[drive].dtype=&data_types[system];
unit[drive].blocks=unit[drive].type->heads*unit[drive].type->tracks*
data_types[system].sects*unit[drive].type->sect_mult;
floppy_sizes[MINOR(inode->i_rdev)] = unit[drive].blocks >> 1;
floppy_sizes[minor(inode->i_rdev)] = unit[drive].blocks >> 1;
printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive,
unit[drive].type->name, data_types[system].name);
......@@ -1679,10 +1675,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
static int floppy_release(struct inode * inode, struct file * filp)
{
#ifdef DEBUG
struct super_block * sb;
#endif
int drive = MINOR(inode->i_rdev) & 3;
int drive = minor(inode->i_rdev) & 3;
if (unit[drive].dirty == 1) {
del_timer (flush_track_timer + drive);
......@@ -1708,11 +1701,11 @@ static int floppy_release(struct inode * inode, struct file * filp)
*/
static int amiga_floppy_change(kdev_t dev)
{
int drive = MINOR(dev) & 3;
int drive = minor(dev) & 3;
int changed;
static int first_time = 1;
if (MAJOR(dev) != MAJOR_NR) {
if (major(dev) != MAJOR_NR) {
printk(KERN_CRIT "floppy_change: not a floppy\n");
return 0;
}
......
......@@ -38,7 +38,7 @@
#include <asm/bitops.h>
#include <asm/amigahw.h>
#include <asm/pgtable.h>
#include <asm/io.h>
#include <linux/zorro.h>
......@@ -83,16 +83,16 @@ do_z2_request( request_queue_t * q )
if ( ( start + len ) > z2ram_size )
{
printk( KERN_ERR DEVICE_NAME ": bad access: block=%ld, count=%ld\n",
printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n",
CURRENT->sector,
CURRENT->current_nr_sectors);
end_request( FALSE );
continue;
}
if ( ( CURRENT->cmd != READ ) && ( CURRENT->cmd != WRITE ) )
if ( ( rq_data_dir(CURRENT) != READ ) && ( rq_data_dir(CURRENT) != WRITE ) )
{
printk( KERN_ERR DEVICE_NAME ": bad command: %d\n", CURRENT->cmd );
printk( KERN_ERR DEVICE_NAME ": bad command: %ld\n", rq_data_dir(CURRENT) );
end_request( FALSE );
continue;
}
......@@ -106,7 +106,7 @@ do_z2_request( request_queue_t * q )
addr += z2ram_map[ start >> Z2RAM_CHUNKSHIFT ];
if ( CURRENT->cmd == READ )
if ( rq_data_dir(CURRENT) == READ )
memcpy( CURRENT->buffer, (char *)addr, size );
else
memcpy( (char *)addr, CURRENT->buffer, size );
......@@ -208,7 +208,7 @@ z2_open( struct inode *inode, struct file *filp )
_PAGE_WRITETHRU);
#else
vaddr = (unsigned long)ioremap(paddr, size);
vaddr = (unsigned long)z_remap_nocache_nonser(paddr, size);
#endif
z2ram_map =
kmalloc((size/Z2RAM_CHUNKSIZE)*sizeof(z2ram_map[0]),
......@@ -364,7 +364,7 @@ z2_init( void )
}
}
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &z2ram_lock);
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_z2_request, &z2ram_lock);
blk_size[ MAJOR_NR ] = z2_sizes;
return 0;
......
......@@ -1119,8 +1119,9 @@ NCR53c7x0_init (struct Scsi_Host *host) {
*/
int
ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip,
u32 base, int io_port, int irq, int dma, long long options, int clock)
ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip,
unsigned long base, int io_port, int irq, int dma,
long long options, int clock)
{
struct Scsi_Host *instance;
struct NCR53c7x0_hostdata *hostdata;
......@@ -1224,7 +1225,7 @@ ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip,
memset((void *)instance->hostdata[0], 0, 8192);
cache_push(virt_to_phys((void *)(instance->hostdata[0])), 8192);
cache_clear(virt_to_phys((void *)(instance->hostdata[0])), 8192);
kernel_set_cachemode(instance->hostdata[0], 8192, IOMAP_NOCACHE_SER);
kernel_set_cachemode((void *)instance->hostdata[0], 8192, IOMAP_NOCACHE_SER);
/* FIXME : if we ever support an ISA NCR53c7xx based board, we
need to check if the chip is running in a 16 bit mode, and if so
......@@ -1251,7 +1252,7 @@ ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip,
*/
if (base) {
instance->base = (unsigned char *) (unsigned long) base;
instance->base = base;
/* Check for forced I/O mapping */
if (!(options & OPTION_IO_MAPPED)) {
options |= OPTION_MEMORY_MAPPED;
......@@ -1423,7 +1424,7 @@ NCR53c7x0_init_fixup (struct Scsi_Host *host) {
memory_to_ncr = tmp|DMODE_800_DIOM;
ncr_to_memory = tmp|DMODE_800_SIOM;
} else {
base = virt_to_bus(host->base);
base = virt_to_bus((void *)host->base);
memory_to_ncr = ncr_to_memory = tmp;
}
......@@ -3049,7 +3050,7 @@ my_free_page (void *addr, int dummy)
/* XXX This assumes default cache mode to be IOMAP_FULL_CACHING, which
* XXX may be invalid (CONFIG_060_WRITETHROUGH)
*/
kernel_set_cachemode((u32)addr, 4096, IOMAP_FULL_CACHING);
kernel_set_cachemode((void *)addr, 4096, IOMAP_FULL_CACHING);
free_page ((u32)addr);
}
......@@ -3107,7 +3108,7 @@ allocate_cmd (Scsi_Cmnd *cmd) {
memset((void *)real, 0, 4096);
cache_push(virt_to_phys((void *)real), 4096);
cache_clear(virt_to_phys((void *)real), 4096);
kernel_set_cachemode(real, 4096, IOMAP_NOCACHE_SER);
kernel_set_cachemode((void *)real, 4096, IOMAP_NOCACHE_SER);
tmp = ROUNDUP(real, void *);
#ifdef FORCE_DSA_ALIGNMENT
{
......@@ -6114,7 +6115,7 @@ NCR53c7x0_release(struct Scsi_Host *host) {
/* XXX This assumes default cache mode to be IOMAP_FULL_CACHING, which
* XXX may be invalid (CONFIG_060_WRITETHROUGH)
*/
kernel_set_cachemode((u32)hostdata, 8192, IOMAP_FULL_CACHING);
kernel_set_cachemode((void *)hostdata, 8192, IOMAP_FULL_CACHING);
free_pages ((u32)hostdata, 1);
return 1;
}
......
......@@ -927,7 +927,7 @@ static void esp_get_dmabufs(struct NCR_ESP *esp, Scsi_Cmnd *sp)
esp->dma_mmu_get_scsi_sgl(esp, sp);
else
sp->SCp.ptr =
(char *) virt_to_phys(sp->SCp.buffer->address);
(char *) virt_to_phys((page_address(sp->SCp.buffer->page) + sp->SCp.buffer->offset));
}
}
......@@ -1748,7 +1748,8 @@ static inline void advance_sg(struct NCR_ESP *esp, Scsi_Cmnd *sp)
if (esp->dma_advance_sg)
esp->dma_advance_sg (sp);
else
sp->SCp.ptr = (char *)virt_to_phys(sp->SCp.buffer->address);
sp->SCp.ptr = (char *) virt_to_phys((page_address(sp->SCp.buffer->page) + sp->SCp.buffer->offset));
}
/* Please note that the way I've coded these routines is that I _always_
......
......@@ -40,9 +40,9 @@ static void a2091_intr (int irq, void *dummy, struct pt_regs *fp)
continue;
if (status & ISTR_INTS) {
spin_lock_irqsave(instance->host_lock, flags);
spin_lock_irqsave(&instance->host_lock, flags);
wd33c93_intr (instance);
spin_unlock_irqrestore(instance->host_lock, flags);
spin_unlock_irqrestore(&instance->host_lock, flags);
}
}
}
......@@ -60,7 +60,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
HDATA(instance)->dma_bounce_len = (cmd->SCp.this_residual + 511)
& ~0x1ff;
HDATA(instance)->dma_bounce_buffer =
scsi_malloc (HDATA(instance)->dma_bounce_len);
kmalloc (HDATA(instance)->dma_bounce_len, GFP_KERNEL);
/* can't allocate memory; use PIO */
if (!HDATA(instance)->dma_bounce_buffer) {
......@@ -74,8 +74,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
/* the bounce buffer may not be in the first 16M of physmem */
if (addr & A2091_XFER_MASK) {
/* we could use chipmem... maybe later */
scsi_free (HDATA(instance)->dma_bounce_buffer,
HDATA(instance)->dma_bounce_len);
kfree (HDATA(instance)->dma_bounce_buffer);
HDATA(instance)->dma_bounce_buffer = NULL;
HDATA(instance)->dma_bounce_len = 0;
return 1;
......@@ -162,8 +161,7 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
memcpy (SCpnt->SCp.ptr,
HDATA(instance)->dma_bounce_buffer,
SCpnt->SCp.this_residual);
scsi_free (HDATA(instance)->dma_bounce_buffer,
HDATA(instance)->dma_bounce_len);
kfree (HDATA(instance)->dma_bounce_buffer);
HDATA(instance)->dma_bounce_buffer = NULL;
HDATA(instance)->dma_bounce_len = 0;
......@@ -174,8 +172,7 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
HDATA(instance)->dma_bounce_buffer,
SCpnt->request_bufflen);
scsi_free (HDATA(instance)->dma_bounce_buffer,
HDATA(instance)->dma_bounce_len);
kfree (HDATA(instance)->dma_bounce_buffer);
HDATA(instance)->dma_bounce_buffer = NULL;
HDATA(instance)->dma_bounce_len = 0;
}
......
......@@ -30,15 +30,14 @@ static void a3000_intr (int irq, void *dummy, struct pt_regs *fp)
{
unsigned long flags;
unsigned int status = DMA(a3000_host)->ISTR;
struct Scsi_Host *dev = dummy;
if (!(status & ISTR_INT_P))
return;
if (status & ISTR_INTS)
{
spin_lock_irqsave(dev->host_lock, flags);
spin_lock_irqsave(&a3000_host->host_lock, flags);
wd33c93_intr (a3000_host);
spin_unlock_irqrestore(dev->host_lock, flags);
spin_unlock_irqrestore(&a3000_host->host_lock, flags);
} else
printk("Non-serviced A3000 SCSI-interrupt? ISTR = %02x\n",
status);
......@@ -61,7 +60,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
HDATA(a3000_host)->dma_bounce_len = (cmd->SCp.this_residual + 511)
& ~0x1ff;
HDATA(a3000_host)->dma_bounce_buffer =
scsi_malloc (HDATA(a3000_host)->dma_bounce_len);
kmalloc (HDATA(a3000_host)->dma_bounce_len, GFP_KERNEL);
/* can't allocate memory; use PIO */
if (!HDATA(a3000_host)->dma_bounce_buffer) {
......@@ -152,8 +151,7 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
memcpy (SCpnt->SCp.ptr,
HDATA(instance)->dma_bounce_buffer,
SCpnt->SCp.this_residual);
scsi_free (HDATA(instance)->dma_bounce_buffer,
HDATA(instance)->dma_bounce_len);
kfree (HDATA(instance)->dma_bounce_buffer);
HDATA(instance)->dma_bounce_buffer = NULL;
HDATA(instance)->dma_bounce_len = 0;
} else {
......@@ -162,8 +160,7 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
HDATA(instance)->dma_bounce_buffer,
SCpnt->request_bufflen);
scsi_free (HDATA(instance)->dma_bounce_buffer,
HDATA(instance)->dma_bounce_len);
kfree (HDATA(instance)->dma_bounce_buffer);
HDATA(instance)->dma_bounce_buffer = NULL;
HDATA(instance)->dma_bounce_len = 0;
}
......@@ -200,9 +197,7 @@ int __init a3000_detect(Scsi_Host_Template *tpnt)
return 1;
fail_irq:
#ifdef MODULE
wd33c93_release();
#endif /* MODULE */
scsi_unregister(a3000_host);
fail_register:
release_mem_region(0xDD0000, 256);
......@@ -217,11 +212,11 @@ static Scsi_Host_Template driver_template = _A3000_SCSI;
int __exit a3000_release(struct Scsi_Host *instance)
{
#ifdef MODULE
wd33c93_release();
#endif /* MODULE*/
DMA(instance)->CNTR = 0;
release_mem_region(0xDD0000, 256);
free_irq(IRQ_AMIGA_PORTS, a3000_intr);
return 1;
}
MODULE_LICENSE("GPL");
......@@ -31,7 +31,7 @@
#include<linux/stat.h>
extern int ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip,
u32 base, int io_port, int irq, int dma,
unsigned long base, int io_port, int irq, int dma,
long long options, int clock);
int __init amiga7xx_detect(Scsi_Host_Template *tpnt)
......
......@@ -644,10 +644,7 @@ __inline__ void NCR5380_print_phase(struct Scsi_Host *instance) { };
static volatile int main_running = 0;
static struct tq_struct NCR5380_tqueue = {
NULL, /* next */
0, /* sync */
(void (*)(void*))NCR5380_main, /* routine, must have (void *) arg... */
NULL /* data */
routine: (void (*)(void*))NCR5380_main /* must have (void *) arg... */
};
static __inline__ void queue_main(void)
......
......@@ -24,7 +24,7 @@
#include<linux/stat.h>
extern ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip,
u32 base, int io_port, int irq, int dma,
unsigned long base, int io_port, int irq, int dma,
long long options, int clock);
int bvme6000_scsi_detect(Scsi_Host_Template *tpnt)
......@@ -44,7 +44,7 @@ int bvme6000_scsi_detect(Scsi_Host_Template *tpnt)
clock = 40000000; /* 66MHz SCSI Clock */
ncr53c7xx_init(tpnt, 0, 710, (u32)BVME_NCR53C710_BASE,
ncr53c7xx_init(tpnt, 0, 710, (unsigned long)BVME_NCR53C710_BASE,
0, BVME_IRQ_SCSI, DMA_NONE,
options, clock);
called = 1;
......
......@@ -40,9 +40,9 @@ static void gvp11_intr (int irq, void *dummy, struct pt_regs *fp)
if (!(status & GVP11_DMAC_INT_PENDING))
continue;
spin_lock_irqsave(instance->host_lock, flags);
spin_lock_irqsave(&instance->host_lock, flags);
wd33c93_intr (instance);
spin_unlock_irqrestore(instance->host_lock, flags);
spin_unlock_irqrestore(&instance->host_lock, flags);
}
}
......@@ -69,7 +69,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
if( !scsi_alloc_out_of_range ) {
HDATA(cmd->host)->dma_bounce_buffer =
scsi_malloc (HDATA(cmd->host)->dma_bounce_len);
kmalloc (HDATA(cmd->host)->dma_bounce_len, GFP_KERNEL);
HDATA(cmd->host)->dma_buffer_pool = BUF_SCSI_ALLOCED;
}
......@@ -93,8 +93,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
if (addr & HDATA(cmd->host)->dma_xfer_mask) {
/* fall back to Chip RAM if address out of range */
if( HDATA(cmd->host)->dma_buffer_pool == BUF_SCSI_ALLOCED) {
scsi_free (HDATA(cmd->host)->dma_bounce_buffer,
HDATA(cmd->host)->dma_bounce_len);
kfree (HDATA(cmd->host)->dma_bounce_buffer);
scsi_alloc_out_of_range = 1;
} else {
amiga_chip_free (HDATA(cmd->host)->dma_bounce_buffer);
......@@ -164,8 +163,7 @@ static void dma_stop (struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
SCpnt->SCp.this_residual);
if (HDATA(instance)->dma_buffer_pool == BUF_SCSI_ALLOCED)
scsi_free (HDATA(instance)->dma_bounce_buffer,
HDATA(instance)->dma_bounce_len);
kfree (HDATA(instance)->dma_bounce_buffer);
else
amiga_chip_free(HDATA(instance)->dma_bounce_buffer);
......
......@@ -662,10 +662,7 @@ __inline__ void NCR5380_print_phase(struct Scsi_Host *instance) { };
static volatile int main_running = 0;
static struct tq_struct NCR5380_tqueue = {
NULL, /* next */
0, /* sync */
(void (*)(void*))NCR5380_main, /* routine, must have (void *) arg... */
NULL /* data */
routine: (void (*)(void*))NCR5380_main /* must have (void *) arg... */
};
static __inline__ void queue_main(void)
......
......@@ -22,7 +22,7 @@
#include<linux/stat.h>
extern ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip,
u32 base, int io_port, int irq, int dma,
unsigned long base, int io_port, int irq, int dma,
long long options, int clock);
int mvme16x_scsi_detect(Scsi_Host_Template *tpnt)
......@@ -46,7 +46,7 @@ int mvme16x_scsi_detect(Scsi_Host_Template *tpnt)
clock = 66000000; /* 66MHz SCSI Clock */
ncr53c7xx_init(tpnt, 0, 710, (u32)0xfff47000,
ncr53c7xx_init(tpnt, 0, 710, (unsigned long)0xfff47000,
0, MVME16x_IRQ_SCSI, DMA_NONE,
options, clock);
called = 1;
......
......@@ -77,7 +77,9 @@ static void dma_commit(void *opaque);
long oktag_to_io(long *paddr, long *addr, long len);
long oktag_from_io(long *addr, long *paddr, long len);
static struct tq_struct tq_fake_dma = { NULL, 0, dma_commit, NULL };
static struct tq_struct tq_fake_dma = {
routine: dma_commit,
};
#define DMA_MAXTRANSFER 0x8000
......
......@@ -43,22 +43,23 @@ struct Scsi_Host *sgiwd93_host = NULL;
struct Scsi_Host *sgiwd93_host1 = NULL;
/* Wuff wuff, wuff, wd33c93.c, wuff wuff, object oriented, bow wow. */
static inline void write_wd33c93_count(wd33c93_regs *regp, unsigned long value)
static inline void write_wd33c93_count(const wd33c93_regs regs,
unsigned long value)
{
regp->SASR = WD_TRANSFER_COUNT_MSB;
regp->SCMD = ((value >> 16) & 0xff);
regp->SCMD = ((value >> 8) & 0xff);
regp->SCMD = ((value >> 0) & 0xff);
*regs.SASR = WD_TRANSFER_COUNT_MSB;
*regs.SCMD = ((value >> 16) & 0xff);
*regs.SCMD = ((value >> 8) & 0xff);
*regs.SCMD = ((value >> 0) & 0xff);
}
static inline unsigned long read_wd33c93_count(wd33c93_regs *regp)
static inline unsigned long read_wd33c93_count(const wd33c93_regs regs)
{
unsigned long value;
regp->SASR = WD_TRANSFER_COUNT_MSB;
value = ((regp->SCMD & 0xff) << 16);
value |= ((regp->SCMD & 0xff) << 8);
value |= ((regp->SCMD & 0xff) << 0);
*regs.SASR = WD_TRANSFER_COUNT_MSB;
value = (*regs.SCMD << 16);
value |= (*regs.SCMD << 8);
value |= (*regs.SCMD << 0);
return value;
}
......@@ -100,7 +101,7 @@ void fill_hpc_entries (struct hpc_chunk **hcp, char *addr, unsigned long len)
static int dma_setup(Scsi_Cmnd *cmd, int datainp)
{
struct WD33C93_hostdata *hdata = (struct WD33C93_hostdata *)cmd->host->hostdata;
wd33c93_regs *regp = hdata->regp;
const wd33c93_regs regs = hdata->regs;
struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) cmd->host->base;
struct hpc_chunk *hcp = (struct hpc_chunk *) hdata->dma_bounce_buffer;
......@@ -133,7 +134,7 @@ static int dma_setup(Scsi_Cmnd *cmd, int datainp)
printk(">tlen<%d>", totlen);
#endif
hdata->dma_bounce_len = totlen; /* a trick... */
write_wd33c93_count(regp, totlen);
write_wd33c93_count(regs, totlen);
} else {
/* Non-scattered dma. */
#ifdef DEBUG_DMA
......@@ -149,7 +150,7 @@ static int dma_setup(Scsi_Cmnd *cmd, int datainp)
if (cmd->SCp.ptr == NULL)
return 1;
fill_hpc_entries (&hcp, cmd->SCp.ptr,cmd->SCp.this_residual);
write_wd33c93_count(regp, cmd->SCp.this_residual);
write_wd33c93_count(regs, cmd->SCp.this_residual);
}
/* To make sure, if we trip an HPC bug, that we transfer
......@@ -176,7 +177,7 @@ static void dma_stop(struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
int status)
{
struct WD33C93_hostdata *hdata = (struct WD33C93_hostdata *)instance->hostdata;
wd33c93_regs *regp = hdata->regp;
const wd33c93_regs regs = hdata->regs;
struct hpc3_scsiregs *hregs;
if (!SCpnt)
......@@ -203,7 +204,7 @@ static void dma_stop(struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
/* Yep, we were doing the scatterlist thang. */
totlen = hdata->dma_bounce_len;
wd93_residual = read_wd33c93_count(regp);
wd93_residual = read_wd33c93_count(regs);
transferred = totlen - wd93_residual;
#ifdef DEBUG_DMA
......@@ -273,6 +274,7 @@ int __init sgiwd93_detect(Scsi_Host_Template *SGIblows)
struct WD33C93_hostdata *hdata;
struct WD33C93_hostdata *hdata1;
uchar *buf;
wd33c93_regs regs;
if(called)
return 0; /* Should bitch on the console about this... */
......@@ -294,8 +296,9 @@ int __init sgiwd93_detect(Scsi_Host_Template *SGIblows)
init_hpc_chain(buf);
dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
/* HPC_SCSI_REG0 | 0x03 | KSEG1 */
wd33c93_init(sgiwd93_host, (wd33c93_regs *) KSEG1ADDR (0x1fbc0003),
dma_setup, dma_stop, WD33C93_FS_16_20);
regs.SASR = (volatile unsigned char *)KSEG1ADDR (0x1fbc0003);
regs.SCMD = (volatile unsigned char *)KSEG1ADDR (0x1fbc0007);
wd33c93_init(sgiwd93_host, regs, dma_setup, dma_stop, WD33C93_FS_16_20);
hdata = (struct WD33C93_hostdata *)sgiwd93_host->hostdata;
hdata->no_sync = 0;
......@@ -328,8 +331,10 @@ int __init sgiwd93_detect(Scsi_Host_Template *SGIblows)
init_hpc_chain(buf);
dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
/* HPC_SCSI_REG1 | 0x03 | KSEG1 */
wd33c93_init(sgiwd93_host1, (wd33c93_regs *) KSEG1ADDR (0x1fbc8003),
dma_setup, dma_stop, WD33C93_FS_16_20);
regs.SASR = (volatile unsigned char *)KSEG1ADDR (0x1fbc8003);
regs.SCMD = (volatile unsigned char *)KSEG1ADDR (0x1fbc8007);
wd33c93_init(sgiwd93_host1, regs, dma_setup, dma_stop,
WD33C93_FS_16_20);
hdata1 = (struct WD33C93_hostdata *)sgiwd93_host1->hostdata;
hdata1->no_sync = 0;
......
......@@ -349,7 +349,8 @@ DB(DB_QUEUE_COMMAND,printk("Q-%d-%02x-%ld( ",cmd->target,cmd->cmnd[0],cmd->pid))
if (cmd->use_sg) {
cmd->SCp.buffer = (struct scatterlist *)cmd->buffer;
cmd->SCp.buffers_residual = cmd->use_sg - 1;
cmd->SCp.ptr = (char *)cmd->SCp.buffer->address;
cmd->SCp.ptr = page_address(cmd->SCp.buffer->page)+
cmd->SCp.buffer->offset;
cmd->SCp.this_residual = cmd->SCp.buffer->length;
}
else {
......@@ -692,7 +693,8 @@ unsigned long length;
++cmd->SCp.buffer;
--cmd->SCp.buffers_residual;
cmd->SCp.this_residual = cmd->SCp.buffer->length;
cmd->SCp.ptr = cmd->SCp.buffer->address;
cmd->SCp.ptr = page_address(cmd->SCp.buffer->page)+
cmd->SCp.buffer->offset;
}
write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,hostdata->sync_xfer[cmd->target]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment