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