Commit cbd5f69b authored by Leubner, Achim's avatar Leubner, Achim Committed by James Bottomley

[SCSI] remove the scsi_request interface from the gdth driver

Initial pass at converting the gdth driver away from the scsi_request
interface so that the request interface can be removed post 2.6.18
without breaking gdth.  Based on changes from Christoph Hellwig
<hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 5d5ff44f
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* Intel Corporation: Storage RAID Controllers * * Intel Corporation: Storage RAID Controllers *
* * * *
* gdth.c * * gdth.c *
* Copyright (C) 1995-04 ICP vortex GmbH, Achim Leubner * * Copyright (C) 1995-06 ICP vortex GmbH, Achim Leubner *
* Copyright (C) 2002-04 Intel Corporation * * Copyright (C) 2002-04 Intel Corporation *
* Copyright (C) 2003-04 Adaptec Inc. * * Copyright (C) 2003-06 Adaptec Inc. *
* <achim_leubner@adaptec.com> * * <achim_leubner@adaptec.com> *
* * * *
* Additions/Fixes: * * Additions/Fixes: *
...@@ -27,9 +27,14 @@ ...@@ -27,9 +27,14 @@
* along with this kernel; if not, write to the Free Software * * along with this kernel; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
* * * *
* Linux kernel 2.2.x, 2.4.x, 2.6.x supported * * Linux kernel 2.4.x, 2.6.x supported *
* * * *
* $Log: gdth.c,v $ * $Log: gdth.c,v $
* Revision 1.74 2006/04/10 13:44:47 achim
* Community changes for 2.6.x
* Kernel 2.2.x no longer supported
* scsi_request interface removed, thanks to Christoph Hellwig
*
* Revision 1.73 2004/03/31 13:33:03 achim * Revision 1.73 2004/03/31 13:33:03 achim
* Special command 0xfd implemented to detect 64-bit DMA support * Special command 0xfd implemented to detect 64-bit DMA support
* *
...@@ -94,7 +99,7 @@ ...@@ -94,7 +99,7 @@
* Bugfix free_irq() * Bugfix free_irq()
* *
* Revision 1.56 2001/08/09 11:19:39 achim * Revision 1.56 2001/08/09 11:19:39 achim
* struct scsi_host_template changes * Scsi_Host_Template changes
* *
* Revision 1.55 2001/08/09 10:11:28 achim * Revision 1.55 2001/08/09 10:11:28 achim
* Command HOST_UNFREEZE_IO before cache service init. * Command HOST_UNFREEZE_IO before cache service init.
...@@ -388,7 +393,13 @@ ...@@ -388,7 +393,13 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/timer.h> #include <linux/timer.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,6)
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#else
#define DMA_32BIT_MASK 0x00000000ffffffffULL
#define DMA_64BIT_MASK 0xffffffffffffffffULL
#endif
#ifdef GDTH_RTC #ifdef GDTH_RTC
#include <linux/mc146818rtc.h> #include <linux/mc146818rtc.h>
#endif #endif
...@@ -408,8 +419,8 @@ ...@@ -408,8 +419,8 @@
#include "scsi.h" #include "scsi.h"
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#include "gdth.h"
#include "gdth_kcompat.h" #include "gdth_kcompat.h"
#include "gdth.h"
static void gdth_delay(int milliseconds); static void gdth_delay(int milliseconds);
static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs); static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs);
...@@ -464,6 +475,8 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, ...@@ -464,6 +475,8 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
static void gdth_flush(int hanum); static void gdth_flush(int hanum);
static int gdth_halt(struct notifier_block *nb, ulong event, void *buf); static int gdth_halt(struct notifier_block *nb, ulong event, void *buf);
static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *));
static void gdth_scsi_done(struct scsi_cmnd *scp);
#ifdef DEBUG_GDTH #ifdef DEBUG_GDTH
static unchar DebugState = DEBUG_GDTH; static unchar DebugState = DEBUG_GDTH;
...@@ -643,6 +656,7 @@ static int probe_eisa_isa = 0; ...@@ -643,6 +656,7 @@ static int probe_eisa_isa = 0;
static int force_dma32 = 0; static int force_dma32 = 0;
/* parameters for modprobe/insmod */ /* parameters for modprobe/insmod */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
module_param_array(irq, int, NULL, 0); module_param_array(irq, int, NULL, 0);
module_param(disable, int, 0); module_param(disable, int, 0);
module_param(reserve_mode, int, 0); module_param(reserve_mode, int, 0);
...@@ -655,6 +669,20 @@ module_param(virt_ctr, int, 0); ...@@ -655,6 +669,20 @@ module_param(virt_ctr, int, 0);
module_param(shared_access, int, 0); module_param(shared_access, int, 0);
module_param(probe_eisa_isa, int, 0); module_param(probe_eisa_isa, int, 0);
module_param(force_dma32, int, 0); module_param(force_dma32, int, 0);
#else
MODULE_PARM(irq, "i");
MODULE_PARM(disable, "i");
MODULE_PARM(reserve_mode, "i");
MODULE_PARM(reserve_list, "4-" __MODULE_STRING(MAX_RES_ARGS) "i");
MODULE_PARM(reverse_scan, "i");
MODULE_PARM(hdr_channel, "i");
MODULE_PARM(max_ids, "i");
MODULE_PARM(rescan, "i");
MODULE_PARM(virt_ctr, "i");
MODULE_PARM(shared_access, "i");
MODULE_PARM(probe_eisa_isa, "i");
MODULE_PARM(force_dma32, "i");
#endif
MODULE_AUTHOR("Achim Leubner"); MODULE_AUTHOR("Achim Leubner");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -683,6 +711,91 @@ static void gdth_delay(int milliseconds) ...@@ -683,6 +711,91 @@ static void gdth_delay(int milliseconds)
} }
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
static void gdth_scsi_done(struct scsi_cmnd *scp)
{
TRACE2(("gdth_scsi_done()\n"));
if (scp->sc_request)
complete((struct completion *)scp->sc_request);
}
int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd,
int timeout, u32 *info)
{
Scsi_Cmnd *scp;
DECLARE_COMPLETION(wait);
int rval;
scp = kmalloc(sizeof(*scp), GFP_KERNEL);
if (!scp)
return -ENOMEM;
memset(scp, 0, sizeof(*scp));
scp->device = sdev;
/* use sc_request field to save the ptr. to completion struct. */
scp->sc_request = (struct scsi_request *)&wait;
scp->timeout_per_command = timeout*HZ;
scp->request_buffer = gdtcmd;
scp->cmd_len = 12;
memcpy(scp->cmnd, cmnd, 12);
scp->SCp.this_residual = IOCTL_PRI; /* priority */
scp->done = gdth_scsi_done; /* some fn. test this */
gdth_queuecommand(scp, gdth_scsi_done);
wait_for_completion(&wait);
rval = scp->SCp.Status;
if (info)
*info = scp->SCp.Message;
kfree(scp);
return rval;
}
#else
static void gdth_scsi_done(Scsi_Cmnd *scp)
{
TRACE2(("gdth_scsi_done()\n"));
scp->request.rq_status = RQ_SCSI_DONE;
if (scp->request.waiting)
complete(scp->request.waiting);
}
int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd,
int timeout, u32 *info)
{
Scsi_Cmnd *scp = scsi_allocate_device(sdev, 1, FALSE);
unsigned bufflen = gdtcmd ? sizeof(gdth_cmd_str) : 0;
DECLARE_COMPLETION(wait);
int rval;
if (!scp)
return -ENOMEM;
scp->cmd_len = 12;
scp->use_sg = 0;
scp->SCp.this_residual = IOCTL_PRI; /* priority */
scp->request.rq_status = RQ_SCSI_BUSY;
scp->request.waiting = &wait;
scsi_do_cmd(scp, cmnd, gdtcmd, bufflen, gdth_scsi_done, timeout*HZ, 1);
wait_for_completion(&wait);
rval = scp->SCp.Status;
if (info)
*info = scp->SCp.Message;
scsi_release_command(scp);
return rval;
}
#endif
int gdth_execute(struct Scsi_Host *shost, gdth_cmd_str *gdtcmd, char *cmnd,
int timeout, u32 *info)
{
struct scsi_device *sdev = scsi_get_host_dev(shost);
int rval = __gdth_execute(sdev, gdtcmd, cmnd, timeout, info);
scsi_free_host_dev(sdev);
return rval;
}
static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs) static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs)
{ {
*cyls = size /HEADS/SECS; *cyls = size /HEADS/SECS;
...@@ -773,7 +886,7 @@ static struct pci_device_id gdthtable[] __attribute_used__ = { ...@@ -773,7 +886,7 @@ static struct pci_device_id gdthtable[] __attribute_used__ = {
MODULE_DEVICE_TABLE(pci,gdthtable); MODULE_DEVICE_TABLE(pci,gdthtable);
static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt, static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt,
ushort vendor, ushort device) ushort vendor, ushort device)
{ {
ulong base0, base1, base2; ulong base0, base1, base2;
struct pci_dev *pdev; struct pci_dev *pdev;
...@@ -2248,14 +2361,16 @@ static void gdth_putq(int hanum,Scsi_Cmnd *scp,unchar priority) ...@@ -2248,14 +2361,16 @@ static void gdth_putq(int hanum,Scsi_Cmnd *scp,unchar priority)
ha = HADATA(gdth_ctr_tab[hanum]); ha = HADATA(gdth_ctr_tab[hanum]);
spin_lock_irqsave(&ha->smp_lock, flags); spin_lock_irqsave(&ha->smp_lock, flags);
scp->SCp.this_residual = (int)priority; if (scp->done != gdth_scsi_done) {
b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; scp->SCp.this_residual = (int)priority;
t = scp->device->id; b = virt_ctr ? NUMDATA(scp->device->host)->busnum:scp->device->channel;
if (priority >= DEFAULT_PRI) { t = scp->device->id;
if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) || if (priority >= DEFAULT_PRI) {
(b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) { if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) ||
TRACE2(("gdth_putq(): locked IO -> update_timeout()\n")); (b==ha->virt_bus && t<MAX_HDRIVES && ha->hdr[t].lock)) {
scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0); TRACE2(("gdth_putq(): locked IO ->update_timeout()\n"));
scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0);
}
} }
} }
...@@ -2309,14 +2424,18 @@ static void gdth_next(int hanum) ...@@ -2309,14 +2424,18 @@ static void gdth_next(int hanum)
for (nscp = pscp = ha->req_first; nscp; nscp = (Scsi_Cmnd *)nscp->SCp.ptr) { for (nscp = pscp = ha->req_first; nscp; nscp = (Scsi_Cmnd *)nscp->SCp.ptr) {
if (nscp != pscp && nscp != (Scsi_Cmnd *)pscp->SCp.ptr) if (nscp != pscp && nscp != (Scsi_Cmnd *)pscp->SCp.ptr)
pscp = (Scsi_Cmnd *)pscp->SCp.ptr; pscp = (Scsi_Cmnd *)pscp->SCp.ptr;
b = virt_ctr ? NUMDATA(nscp->device->host)->busnum : nscp->device->channel; if (nscp->done != gdth_scsi_done) {
t = nscp->device->id; b = virt_ctr ?
l = nscp->device->lun; NUMDATA(nscp->device->host)->busnum : nscp->device->channel;
if (nscp->SCp.this_residual >= DEFAULT_PRI) { t = nscp->device->id;
if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) || l = nscp->device->lun;
(b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) if (nscp->SCp.this_residual >= DEFAULT_PRI) {
continue; if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) ||
} (b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock))
continue;
}
} else
b = t = l = 0;
if (firsttime) { if (firsttime) {
if (gdth_test_busy(hanum)) { /* controller busy ? */ if (gdth_test_busy(hanum)) { /* controller busy ? */
...@@ -2331,7 +2450,7 @@ static void gdth_next(int hanum) ...@@ -2331,7 +2450,7 @@ static void gdth_next(int hanum)
firsttime = FALSE; firsttime = FALSE;
} }
if (nscp->done != gdth_scsi_done || nscp->cmnd[0] != 0xff) { if (nscp->done != gdth_scsi_done) {
if (nscp->SCp.phase == -1) { if (nscp->SCp.phase == -1) {
nscp->SCp.phase = CACHESERVICE; /* default: cache svc. */ nscp->SCp.phase = CACHESERVICE; /* default: cache svc. */
if (nscp->cmnd[0] == TEST_UNIT_READY) { if (nscp->cmnd[0] == TEST_UNIT_READY) {
...@@ -2394,7 +2513,7 @@ static void gdth_next(int hanum) ...@@ -2394,7 +2513,7 @@ static void gdth_next(int hanum)
else else
nscp->scsi_done(nscp); nscp->scsi_done(nscp);
} }
} else if (nscp->done == gdth_scsi_done && nscp->cmnd[0] == 0xff) { } else if (nscp->done == gdth_scsi_done) {
if (!(cmd_index=gdth_special_cmd(hanum,nscp))) if (!(cmd_index=gdth_special_cmd(hanum,nscp)))
this_cmd = FALSE; this_cmd = FALSE;
next_cmd = FALSE; next_cmd = FALSE;
...@@ -2548,7 +2667,7 @@ static void gdth_copy_internal_data(int hanum,Scsi_Cmnd *scp, ...@@ -2548,7 +2667,7 @@ static void gdth_copy_internal_data(int hanum,Scsi_Cmnd *scp,
if (scp->use_sg) { if (scp->use_sg) {
sl = (struct scatterlist *)scp->request_buffer; sl = (struct scatterlist *)scp->request_buffer;
for (i=0,cpsum=0; i<scp->use_sg; ++i,++sl) { for (i=0,cpsum=0; i<scp->use_sg; ++i,++sl) {
unsigned long flags; unsigned long flags;
cpnow = (ushort)sl->length; cpnow = (ushort)sl->length;
TRACE(("copy_internal() now %d sum %d count %d %d\n", TRACE(("copy_internal() now %d sum %d count %d %d\n",
cpnow,cpsum,cpcount,(ushort)scp->bufflen)); cpnow,cpsum,cpcount,(ushort)scp->bufflen));
...@@ -2560,12 +2679,19 @@ static void gdth_copy_internal_data(int hanum,Scsi_Cmnd *scp, ...@@ -2560,12 +2679,19 @@ static void gdth_copy_internal_data(int hanum,Scsi_Cmnd *scp,
hanum); hanum);
return; return;
} }
local_irq_save(flags); local_irq_save(flags);
address = kmap_atomic(sl->page, KM_BIO_SRC_IRQ) + sl->offset; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
address = kmap_atomic(sl->page, KM_BIO_SRC_IRQ) + sl->offset;
memcpy(address,buffer,cpnow);
flush_dcache_page(sl->page);
kunmap_atomic(address, KM_BIO_SRC_IRQ);
#else
address = kmap_atomic(sl->page, KM_BH_IRQ) + sl->offset;
memcpy(address,buffer,cpnow); memcpy(address,buffer,cpnow);
flush_dcache_page(sl->page); flush_dcache_page(sl->page);
kunmap_atomic(address, KM_BIO_SRC_IRQ); kunmap_atomic(address, KM_BH_IRQ);
local_irq_restore(flags); #endif
local_irq_restore(flags);
if (cpsum == cpcount) if (cpsum == cpcount)
break; break;
buffer += cpnow; buffer += cpnow;
...@@ -2946,9 +3072,9 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b) ...@@ -2946,9 +3072,9 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b)
offset = (ulong)scp->sense_buffer & ~PAGE_MASK; offset = (ulong)scp->sense_buffer & ~PAGE_MASK;
sense_paddr = pci_map_page(ha->pdev,page,offset, sense_paddr = pci_map_page(ha->pdev,page,offset,
16,PCI_DMA_FROMDEVICE); 16,PCI_DMA_FROMDEVICE);
scp->SCp.buffer = (struct scatterlist *)((ulong32)sense_paddr); *(ulong32 *)&scp->SCp.buffer = (ulong32)sense_paddr;
/* high part, if 64bit */ /* high part, if 64bit */
scp->host_scribble = (char *)(ulong32)((ulong64)sense_paddr >> 32); *(ulong32 *)&scp->host_scribble = (ulong32)((ulong64)sense_paddr >> 32);
cmdp->OpCode = GDT_WRITE; /* always */ cmdp->OpCode = GDT_WRITE; /* always */
cmdp->BoardNode = LOCALBOARD; cmdp->BoardNode = LOCALBOARD;
if (mode64) { if (mode64) {
...@@ -3022,7 +3148,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b) ...@@ -3022,7 +3148,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b)
} }
#endif #endif
} else { } else if (scp->request_bufflen) {
scp->SCp.Status = GDTH_MAP_SINGLE; scp->SCp.Status = GDTH_MAP_SINGLE;
scp->SCp.Message = PCI_DMA_BIDIRECTIONAL; scp->SCp.Message = PCI_DMA_BIDIRECTIONAL;
page = virt_to_page(scp->request_buffer); page = virt_to_page(scp->request_buffer);
...@@ -3309,7 +3435,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id,struct pt_regs *regs) ...@@ -3309,7 +3435,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id,struct pt_regs *regs)
} }
if (!gdth_polling) if (!gdth_polling)
spin_lock_irqsave(&ha2->smp_lock, flags); spin_lock_irqsave(&ha2->smp_lock, flags);
wait_index = 0; wait_index = 0;
/* search controller */ /* search controller */
...@@ -3642,9 +3768,10 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp) ...@@ -3642,9 +3768,10 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp)
scp->request_bufflen,scp->SCp.Message); scp->request_bufflen,scp->SCp.Message);
if (scp->SCp.buffer) { if (scp->SCp.buffer) {
dma_addr_t addr; dma_addr_t addr;
addr = (dma_addr_t)(ulong32)scp->SCp.buffer; addr = (dma_addr_t)*(ulong32 *)&scp->SCp.buffer;
if (scp->host_scribble) if (scp->host_scribble)
addr += (dma_addr_t)((ulong64)(ulong32)scp->host_scribble << 32); addr += (dma_addr_t)
((ulong64)(*(ulong32 *)&scp->host_scribble) << 32);
pci_unmap_page(ha->pdev,addr,16,PCI_DMA_FROMDEVICE); pci_unmap_page(ha->pdev,addr,16,PCI_DMA_FROMDEVICE);
} }
...@@ -4154,7 +4281,11 @@ int __init option_setup(char *str) ...@@ -4154,7 +4281,11 @@ int __init option_setup(char *str)
return 1; return 1;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
static int __init gdth_detect(struct scsi_host_template *shtp) static int __init gdth_detect(struct scsi_host_template *shtp)
#else
static int __init gdth_detect(Scsi_Host_Template *shtp)
#endif
{ {
struct Scsi_Host *shp; struct Scsi_Host *shp;
gdth_pci_str pcistr[MAXHA]; gdth_pci_str pcistr[MAXHA];
...@@ -4188,7 +4319,7 @@ static int __init gdth_detect(struct scsi_host_template *shtp) ...@@ -4188,7 +4319,7 @@ static int __init gdth_detect(struct scsi_host_template *shtp)
return 0; return 0;
} }
printk("GDT-HA: Storage RAID Controller Driver. Version: %s \n",GDTH_VERSION_STR); printk("GDT-HA: Storage RAID Controller Driver. Version: %s\n",GDTH_VERSION_STR);
/* initializations */ /* initializations */
gdth_polling = TRUE; b = 0; gdth_polling = TRUE; b = 0;
gdth_clear_events(); gdth_clear_events();
...@@ -4751,7 +4882,7 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *scp) ...@@ -4751,7 +4882,7 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *scp)
gdth_internal_cmd(hanum, SCSIRAWSERVICE, GDT_RESET_BUS, gdth_internal_cmd(hanum, SCSIRAWSERVICE, GDT_RESET_BUS,
BUS_L2P(ha,b), 0, 0); BUS_L2P(ha,b), 0, 0);
gdth_polling = FALSE; gdth_polling = FALSE;
spin_unlock_irqrestore(&ha->smp_lock, flags); spin_unlock_irqrestore(&ha->smp_lock, flags);
} }
return SUCCESS; return SUCCESS;
} }
...@@ -4819,7 +4950,9 @@ static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)) ...@@ -4819,7 +4950,9 @@ static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *))
priority = DEFAULT_PRI; priority = DEFAULT_PRI;
if (scp->done == gdth_scsi_done) if (scp->done == gdth_scsi_done)
priority = scp->SCp.this_residual; priority = scp->SCp.this_residual;
gdth_update_timeout(hanum, scp, scp->timeout_per_command * 6); else
gdth_update_timeout(hanum, scp, scp->timeout_per_command * 6);
gdth_putq( hanum, scp, priority ); gdth_putq( hanum, scp, priority );
gdth_next( hanum ); gdth_next( hanum );
return 0; return 0;
...@@ -4922,11 +5055,7 @@ static int ioc_resetdrv(void __user *arg, char *cmnd) ...@@ -4922,11 +5055,7 @@ static int ioc_resetdrv(void __user *arg, char *cmnd)
gdth_cmd_str cmd; gdth_cmd_str cmd;
int hanum; int hanum;
gdth_ha_str *ha; gdth_ha_str *ha;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) int rval;
Scsi_Request *srp;
#else
Scsi_Cmnd *scp;
#endif
if (copy_from_user(&res, arg, sizeof(gdth_ioctl_reset)) || if (copy_from_user(&res, arg, sizeof(gdth_ioctl_reset)) ||
res.ionode >= gdth_ctr_count || res.number >= MAX_HDRIVES) res.ionode >= gdth_ctr_count || res.number >= MAX_HDRIVES)
...@@ -4943,25 +5072,11 @@ static int ioc_resetdrv(void __user *arg, char *cmnd) ...@@ -4943,25 +5072,11 @@ static int ioc_resetdrv(void __user *arg, char *cmnd)
cmd.u.cache64.DeviceNo = res.number; cmd.u.cache64.DeviceNo = res.number;
else else
cmd.u.cache.DeviceNo = res.number; cmd.u.cache.DeviceNo = res.number;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
srp = scsi_allocate_request(ha->sdev, GFP_KERNEL); rval = __gdth_execute(ha->sdev, &cmd, cmnd, 30, NULL);
if (!srp) if (rval < 0)
return -ENOMEM; return rval;
srp->sr_cmd_len = 12; res.status = rval;
srp->sr_use_sg = 0;
gdth_do_req(srp, &cmd, cmnd, 30);
res.status = (ushort)srp->sr_command->SCp.Status;
scsi_release_request(srp);
#else
scp = scsi_allocate_device(ha->sdev, 1, FALSE);
if (!scp)
return -ENOMEM;
scp->cmd_len = 12;
scp->use_sg = 0;
gdth_do_cmd(scp, &cmd, cmnd, 30);
res.status = (ushort)scp->SCp.Status;
scsi_release_command(scp);
#endif
if (copy_to_user(arg, &res, sizeof(gdth_ioctl_reset))) if (copy_to_user(arg, &res, sizeof(gdth_ioctl_reset)))
return -EFAULT; return -EFAULT;
...@@ -4974,12 +5089,8 @@ static int ioc_general(void __user *arg, char *cmnd) ...@@ -4974,12 +5089,8 @@ static int ioc_general(void __user *arg, char *cmnd)
char *buf = NULL; char *buf = NULL;
ulong64 paddr; ulong64 paddr;
int hanum; int hanum;
gdth_ha_str *ha; gdth_ha_str *ha;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) int rval;
Scsi_Request *srp;
#else
Scsi_Cmnd *scp;
#endif
if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general)) || if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general)) ||
gen.ionode >= gdth_ctr_count) gen.ionode >= gdth_ctr_count)
...@@ -5071,27 +5182,10 @@ static int ioc_general(void __user *arg, char *cmnd) ...@@ -5071,27 +5182,10 @@ static int ioc_general(void __user *arg, char *cmnd)
} }
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) rval = __gdth_execute(ha->sdev, &gen.command, cmnd, gen.timeout, &gen.info);
srp = scsi_allocate_request(ha->sdev, GFP_KERNEL); if (rval < 0)
if (!srp) return rval;
return -ENOMEM; gen.status = rval;
srp->sr_cmd_len = 12;
srp->sr_use_sg = 0;
gdth_do_req(srp, &gen.command, cmnd, gen.timeout);
gen.status = srp->sr_command->SCp.Status;
gen.info = srp->sr_command->SCp.Message;
scsi_release_request(srp);
#else
scp = scsi_allocate_device(ha->sdev, 1, FALSE);
if (!scp)
return -ENOMEM;
scp->cmd_len = 12;
scp->use_sg = 0;
gdth_do_cmd(scp, &gen.command, cmnd, gen.timeout);
gen.status = scp->SCp.Status;
gen.info = scp->SCp.Message;
scsi_release_command(scp);
#endif
if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf, if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf,
gen.data_len + gen.sense_len)) { gen.data_len + gen.sense_len)) {
...@@ -5114,40 +5208,22 @@ static int ioc_hdrlist(void __user *arg, char *cmnd) ...@@ -5114,40 +5208,22 @@ static int ioc_hdrlist(void __user *arg, char *cmnd)
gdth_ha_str *ha; gdth_ha_str *ha;
unchar i; unchar i;
int hanum, rc = -ENOMEM; int hanum, rc = -ENOMEM;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) u32 cluster_type = 0;
Scsi_Request *srp;
#else
Scsi_Cmnd *scp;
#endif
rsc = kmalloc(sizeof(*rsc), GFP_KERNEL); rsc = kmalloc(sizeof(*rsc), GFP_KERNEL);
cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
if (!rsc || !cmd) if (!rsc || !cmd)
goto free_fail; goto free_fail;
if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) || if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) ||
rsc->ionode >= gdth_ctr_count) { rsc->ionode >= gdth_ctr_count) {
rc = -EFAULT; rc = -EFAULT;
goto free_fail; goto free_fail;
} }
hanum = rsc->ionode; hanum = rsc->ionode;
ha = HADATA(gdth_ctr_tab[hanum]); ha = HADATA(gdth_ctr_tab[hanum]);
memset(cmd, 0, sizeof(gdth_cmd_str)); memset(cmd, 0, sizeof(gdth_cmd_str));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
srp = scsi_allocate_request(ha->sdev, GFP_KERNEL);
if (!srp)
goto free_fail;
srp->sr_cmd_len = 12;
srp->sr_use_sg = 0;
#else
scp = scsi_allocate_device(ha->sdev, 1, FALSE);
if (!scp)
goto free_fail;
scp->cmd_len = 12;
scp->use_sg = 0;
#endif
for (i = 0; i < MAX_HDRIVES; ++i) { for (i = 0; i < MAX_HDRIVES; ++i) {
if (!ha->hdr[i].present) { if (!ha->hdr[i].present) {
rsc->hdr_list[i].bus = 0xff; rsc->hdr_list[i].bus = 0xff;
...@@ -5164,27 +5240,15 @@ static int ioc_hdrlist(void __user *arg, char *cmnd) ...@@ -5164,27 +5240,15 @@ static int ioc_hdrlist(void __user *arg, char *cmnd)
cmd->u.cache64.DeviceNo = i; cmd->u.cache64.DeviceNo = i;
else else
cmd->u.cache.DeviceNo = i; cmd->u.cache.DeviceNo = i;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) if (__gdth_execute(ha->sdev, cmd, cmnd, 30, &cluster_type) == S_OK)
gdth_do_req(srp, cmd, cmnd, 30); rsc->hdr_list[i].cluster_type = cluster_type;
if (srp->sr_command->SCp.Status == S_OK)
rsc->hdr_list[i].cluster_type = srp->sr_command->SCp.Message;
#else
gdth_do_cmd(scp, cmd, cmnd, 30);
if (scp->SCp.Status == S_OK)
rsc->hdr_list[i].cluster_type = scp->SCp.Message;
#endif
} }
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
scsi_release_request(srp);
#else
scsi_release_command(scp);
#endif
if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan))) if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan)))
rc = -EFAULT; rc = -EFAULT;
else else
rc = 0; rc = 0;
free_fail: free_fail:
kfree(rsc); kfree(rsc);
...@@ -5202,40 +5266,21 @@ static int ioc_rescan(void __user *arg, char *cmnd) ...@@ -5202,40 +5266,21 @@ static int ioc_rescan(void __user *arg, char *cmnd)
int rc = -ENOMEM; int rc = -ENOMEM;
ulong flags; ulong flags;
gdth_ha_str *ha; gdth_ha_str *ha;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
Scsi_Request *srp;
#else
Scsi_Cmnd *scp;
#endif
rsc = kmalloc(sizeof(*rsc), GFP_KERNEL); rsc = kmalloc(sizeof(*rsc), GFP_KERNEL);
cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd || !rsc) if (!cmd || !rsc)
goto free_fail; goto free_fail;
if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) || if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) ||
rsc->ionode >= gdth_ctr_count) { rsc->ionode >= gdth_ctr_count) {
rc = -EFAULT; rc = -EFAULT;
goto free_fail; goto free_fail;
} }
hanum = rsc->ionode; hanum = rsc->ionode;
ha = HADATA(gdth_ctr_tab[hanum]); ha = HADATA(gdth_ctr_tab[hanum]);
memset(cmd, 0, sizeof(gdth_cmd_str)); memset(cmd, 0, sizeof(gdth_cmd_str));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
srp = scsi_allocate_request(ha->sdev, GFP_KERNEL);
if (!srp)
goto free_fail;
srp->sr_cmd_len = 12;
srp->sr_use_sg = 0;
#else
scp = scsi_allocate_device(ha->sdev, 1, FALSE);
if (!scp)
goto free_fail;
scp->cmd_len = 12;
scp->use_sg = 0;
#endif
if (rsc->flag == 0) { if (rsc->flag == 0) {
/* old method: re-init. cache service */ /* old method: re-init. cache service */
cmd->Service = CACHESERVICE; cmd->Service = CACHESERVICE;
...@@ -5246,19 +5291,8 @@ static int ioc_rescan(void __user *arg, char *cmnd) ...@@ -5246,19 +5291,8 @@ static int ioc_rescan(void __user *arg, char *cmnd)
cmd->OpCode = GDT_INIT; cmd->OpCode = GDT_INIT;
cmd->u.cache.DeviceNo = LINUX_OS; cmd->u.cache.DeviceNo = LINUX_OS;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(srp, cmd, cmnd, 30); status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
status = (ushort)srp->sr_command->SCp.Status;
info = (ulong32)srp->sr_command->SCp.Message;
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
gdth_do_cmd(scp, cmd, cmnd, 30);
status = (ushort)scp->SCp.Status;
info = (ulong32)scp->SCp.Message;
#else
gdth_do_cmd(&scp, cmd, cmnd, 30);
status = (ushort)scp.SCp.Status;
info = (ulong32)scp.SCp.Message;
#endif
i = 0; i = 0;
hdr_cnt = (status == S_OK ? (ushort)info : 0); hdr_cnt = (status == S_OK ? (ushort)info : 0);
} else { } else {
...@@ -5273,15 +5307,9 @@ static int ioc_rescan(void __user *arg, char *cmnd) ...@@ -5273,15 +5307,9 @@ static int ioc_rescan(void __user *arg, char *cmnd)
cmd->u.cache64.DeviceNo = i; cmd->u.cache64.DeviceNo = i;
else else
cmd->u.cache.DeviceNo = i; cmd->u.cache.DeviceNo = i;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(srp, cmd, cmnd, 30); status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
status = (ushort)srp->sr_command->SCp.Status;
info = (ulong32)srp->sr_command->SCp.Message;
#else
gdth_do_cmd(scp, cmd, cmnd, 30);
status = (ushort)scp->SCp.Status;
info = (ulong32)scp->SCp.Message;
#endif
spin_lock_irqsave(&ha->smp_lock, flags); spin_lock_irqsave(&ha->smp_lock, flags);
rsc->hdr_list[i].bus = ha->virt_bus; rsc->hdr_list[i].bus = ha->virt_bus;
rsc->hdr_list[i].target = i; rsc->hdr_list[i].target = i;
...@@ -5313,15 +5341,9 @@ static int ioc_rescan(void __user *arg, char *cmnd) ...@@ -5313,15 +5341,9 @@ static int ioc_rescan(void __user *arg, char *cmnd)
cmd->u.cache64.DeviceNo = i; cmd->u.cache64.DeviceNo = i;
else else
cmd->u.cache.DeviceNo = i; cmd->u.cache.DeviceNo = i;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(srp, cmd, cmnd, 30); status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
status = (ushort)srp->sr_command->SCp.Status;
info = (ulong32)srp->sr_command->SCp.Message;
#else
gdth_do_cmd(scp, cmd, cmnd, 30);
status = (ushort)scp->SCp.Status;
info = (ulong32)scp->SCp.Message;
#endif
spin_lock_irqsave(&ha->smp_lock, flags); spin_lock_irqsave(&ha->smp_lock, flags);
ha->hdr[i].devtype = (status == S_OK ? (ushort)info : 0); ha->hdr[i].devtype = (status == S_OK ? (ushort)info : 0);
spin_unlock_irqrestore(&ha->smp_lock, flags); spin_unlock_irqrestore(&ha->smp_lock, flags);
...@@ -5332,15 +5354,9 @@ static int ioc_rescan(void __user *arg, char *cmnd) ...@@ -5332,15 +5354,9 @@ static int ioc_rescan(void __user *arg, char *cmnd)
cmd->u.cache64.DeviceNo = i; cmd->u.cache64.DeviceNo = i;
else else
cmd->u.cache.DeviceNo = i; cmd->u.cache.DeviceNo = i;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(srp, cmd, cmnd, 30); status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
status = (ushort)srp->sr_command->SCp.Status;
info = (ulong32)srp->sr_command->SCp.Message;
#else
gdth_do_cmd(scp, cmd, cmnd, 30);
status = (ushort)scp->SCp.Status;
info = (ulong32)scp->SCp.Message;
#endif
spin_lock_irqsave(&ha->smp_lock, flags); spin_lock_irqsave(&ha->smp_lock, flags);
ha->hdr[i].cluster_type = ha->hdr[i].cluster_type =
((status == S_OK && !shared_access) ? (ushort)info : 0); ((status == S_OK && !shared_access) ? (ushort)info : 0);
...@@ -5353,29 +5369,18 @@ static int ioc_rescan(void __user *arg, char *cmnd) ...@@ -5353,29 +5369,18 @@ static int ioc_rescan(void __user *arg, char *cmnd)
cmd->u.cache64.DeviceNo = i; cmd->u.cache64.DeviceNo = i;
else else
cmd->u.cache.DeviceNo = i; cmd->u.cache.DeviceNo = i;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(srp, cmd, cmnd, 30); status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
status = (ushort)srp->sr_command->SCp.Status;
info = (ulong32)srp->sr_command->SCp.Message;
#else
gdth_do_cmd(scp, cmd, cmnd, 30);
status = (ushort)scp->SCp.Status;
info = (ulong32)scp->SCp.Message;
#endif
spin_lock_irqsave(&ha->smp_lock, flags); spin_lock_irqsave(&ha->smp_lock, flags);
ha->hdr[i].rw_attribs = (status == S_OK ? (ushort)info : 0); ha->hdr[i].rw_attribs = (status == S_OK ? (ushort)info : 0);
spin_unlock_irqrestore(&ha->smp_lock, flags); spin_unlock_irqrestore(&ha->smp_lock, flags);
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
scsi_release_request(srp);
#else
scsi_release_command(scp);
#endif
if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan))) if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan)))
rc = -EFAULT; rc = -EFAULT;
else else
rc = 0; rc = 0;
free_fail: free_fail:
kfree(rsc); kfree(rsc);
...@@ -5515,17 +5520,18 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, ...@@ -5515,17 +5520,18 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
hanum = res.ionode; hanum = res.ionode;
ha = HADATA(gdth_ctr_tab[hanum]); ha = HADATA(gdth_ctr_tab[hanum]);
/* Because we need a Scsi_Cmnd struct., we make a scsi_allocate device also for kernels >=2.6.x */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
scp = scsi_get_command(ha->sdev, GFP_KERNEL); scp = kmalloc(sizeof(*scp), GFP_KERNEL);
if (!scp) if (!scp)
return -ENOMEM; return -ENOMEM;
memset(scp, 0, sizeof(*scp));
scp->device = ha->sdev;
scp->cmd_len = 12; scp->cmd_len = 12;
scp->use_sg = 0; scp->use_sg = 0;
scp->device->channel = virt_ctr ? 0 : res.number; scp->device->channel = virt_ctr ? 0 : res.number;
rval = gdth_eh_bus_reset(scp); rval = gdth_eh_bus_reset(scp);
res.status = (rval == SUCCESS ? S_OK : S_GENERR); res.status = (rval == SUCCESS ? S_OK : S_GENERR);
scsi_put_command(scp); kfree(scp);
#else #else
scp = scsi_allocate_device(ha->sdev, 1, FALSE); scp = scsi_allocate_device(ha->sdev, 1, FALSE);
if (!scp) if (!scp)
...@@ -5558,34 +5564,12 @@ static void gdth_flush(int hanum) ...@@ -5558,34 +5564,12 @@ static void gdth_flush(int hanum)
int i; int i;
gdth_ha_str *ha; gdth_ha_str *ha;
gdth_cmd_str gdtcmd; gdth_cmd_str gdtcmd;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
Scsi_Request *srp;
#else
Scsi_Cmnd *scp;
#endif
struct scsi_device *sdev;
char cmnd[MAX_COMMAND_SIZE]; char cmnd[MAX_COMMAND_SIZE];
memset(cmnd, 0xff, MAX_COMMAND_SIZE); memset(cmnd, 0xff, MAX_COMMAND_SIZE);
TRACE2(("gdth_flush() hanum %d\n",hanum)); TRACE2(("gdth_flush() hanum %d\n",hanum));
ha = HADATA(gdth_ctr_tab[hanum]); ha = HADATA(gdth_ctr_tab[hanum]);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp)
return;
srp->sr_cmd_len = 12;
srp->sr_use_sg = 0;
#else
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
scp = scsi_allocate_device(sdev, 1, FALSE);
if (!scp)
return;
scp->cmd_len = 12;
scp->use_sg = 0;
#endif
for (i = 0; i < MAX_HDRIVES; ++i) { for (i = 0; i < MAX_HDRIVES; ++i) {
if (ha->hdr[i].present) { if (ha->hdr[i].present) {
gdtcmd.BoardNode = LOCALBOARD; gdtcmd.BoardNode = LOCALBOARD;
...@@ -5601,20 +5585,10 @@ static void gdth_flush(int hanum) ...@@ -5601,20 +5585,10 @@ static void gdth_flush(int hanum)
gdtcmd.u.cache.sg_canz = 0; gdtcmd.u.cache.sg_canz = 0;
} }
TRACE2(("gdth_flush(): flush ha %d drive %d\n", hanum, i)); TRACE2(("gdth_flush(): flush ha %d drive %d\n", hanum, i));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(srp, &gdtcmd, cmnd, 30); gdth_execute(gdth_ctr_tab[hanum], &gdtcmd, cmnd, 30, NULL);
#else
gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
#endif
} }
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
scsi_release_request(srp);
scsi_free_host_dev(sdev);
#else
scsi_release_command(scp);
scsi_free_host_dev(sdev);
#endif
} }
/* shutdown routine */ /* shutdown routine */
...@@ -5623,18 +5597,11 @@ static int gdth_halt(struct notifier_block *nb, ulong event, void *buf) ...@@ -5623,18 +5597,11 @@ static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
int hanum; int hanum;
#ifndef __alpha__ #ifndef __alpha__
gdth_cmd_str gdtcmd; gdth_cmd_str gdtcmd;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
Scsi_Request *srp;
struct scsi_device *sdev;
#else
Scsi_Cmnd *scp;
struct scsi_device *sdev;
#endif
char cmnd[MAX_COMMAND_SIZE]; char cmnd[MAX_COMMAND_SIZE];
#endif #endif
if (notifier_disabled) if (notifier_disabled)
return NOTIFY_OK; return NOTIFY_OK;
TRACE2(("gdth_halt() event %d\n",(int)event)); TRACE2(("gdth_halt() event %d\n",(int)event));
if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF) if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF)
...@@ -5652,31 +5619,7 @@ static int gdth_halt(struct notifier_block *nb, ulong event, void *buf) ...@@ -5652,31 +5619,7 @@ static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
gdtcmd.Service = CACHESERVICE; gdtcmd.Service = CACHESERVICE;
gdtcmd.OpCode = GDT_RESET; gdtcmd.OpCode = GDT_RESET;
TRACE2(("gdth_halt(): reset controller %d\n", hanum)); TRACE2(("gdth_halt(): reset controller %d\n", hanum));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) gdth_execute(gdth_ctr_tab[hanum], &gdtcmd, cmnd, 10, NULL);
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp) {
unregister_reboot_notifier(&gdth_notifier);
return NOTIFY_OK;
}
srp->sr_cmd_len = 12;
srp->sr_use_sg = 0;
gdth_do_req(srp, &gdtcmd, cmnd, 10);
scsi_release_request(srp);
scsi_free_host_dev(sdev);
#else
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
scp = scsi_allocate_device(sdev, 1, FALSE);
if (!scp) {
unregister_reboot_notifier(&gdth_notifier);
return NOTIFY_OK;
}
scp->cmd_len = 12;
scp->use_sg = 0;
gdth_do_cmd(scp, &gdtcmd, cmnd, 10);
scsi_release_command(scp);
scsi_free_host_dev(sdev);
#endif
#endif #endif
} }
printk("Done.\n"); printk("Done.\n");
...@@ -5687,7 +5630,22 @@ static int gdth_halt(struct notifier_block *nb, ulong event, void *buf) ...@@ -5687,7 +5630,22 @@ static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
return NOTIFY_OK; return NOTIFY_OK;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
/* configure lun */
static int gdth_slave_configure(struct scsi_device *sdev)
{
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
sdev->skip_ms_page_3f = 1;
sdev->skip_ms_page_8 = 1;
return 0;
}
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
static struct scsi_host_template driver_template = { static struct scsi_host_template driver_template = {
#else
static Scsi_Host_Template driver_template = {
#endif
.proc_name = "gdth", .proc_name = "gdth",
.proc_info = gdth_proc_info, .proc_info = gdth_proc_info,
.name = "GDT SCSI Disk Array Controller", .name = "GDT SCSI Disk Array Controller",
...@@ -5698,6 +5656,9 @@ static struct scsi_host_template driver_template = { ...@@ -5698,6 +5656,9 @@ static struct scsi_host_template driver_template = {
.eh_bus_reset_handler = gdth_eh_bus_reset, .eh_bus_reset_handler = gdth_eh_bus_reset,
.bios_param = gdth_bios_param, .bios_param = gdth_bios_param,
.can_queue = GDTH_MAXCMDS, .can_queue = GDTH_MAXCMDS,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
.slave_configure = gdth_slave_configure,
#endif
.this_id = -1, .this_id = -1,
.sg_tablesize = GDTH_MAXSG, .sg_tablesize = GDTH_MAXSG,
.cmd_per_lun = GDTH_MAXC_P_L, .cmd_per_lun = GDTH_MAXC_P_L,
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
/* /*
* Header file for the GDT Disk Array/Storage RAID controllers driver for Linux * Header file for the GDT Disk Array/Storage RAID controllers driver for Linux
* *
* gdth.h Copyright (C) 1995-03 ICP vortex, Achim Leubner * gdth.h Copyright (C) 1995-06 ICP vortex, Achim Leubner
* See gdth.c for further informations and * See gdth.c for further informations and
* below for supported controller types * below for supported controller types
* *
* <achim_leubner@adaptec.com> * <achim_leubner@adaptec.com>
* *
* $Id: gdth.h,v 1.57 2004/03/31 11:52:09 achim Exp $ * $Id: gdth.h,v 1.58 2006/01/11 16:14:09 achim Exp $
*/ */
#include <linux/version.h> #include <linux/version.h>
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
/* defines, macros */ /* defines, macros */
/* driver version */ /* driver version */
#define GDTH_VERSION_STR "3.04" #define GDTH_VERSION_STR "3.05"
#define GDTH_VERSION 3 #define GDTH_VERSION 3
#define GDTH_SUBVERSION 4 #define GDTH_SUBVERSION 5
/* protocol version */ /* protocol version */
#define PROTOCOL_VERSION 1 #define PROTOCOL_VERSION 1
......
#ifndef IRQ_HANDLED #ifndef IRQ_HANDLED
typedef void irqreturn_t; typedef void irqreturn_t;
#define IRQ_NONE #define IRQ_NONE
...@@ -10,6 +8,18 @@ typedef void irqreturn_t; ...@@ -10,6 +8,18 @@ typedef void irqreturn_t;
#define MODULE_LICENSE(x) #define MODULE_LICENSE(x)
#endif #endif
#ifndef __iomem
#define __iomem
#endif
#ifndef __attribute_used__
#define __attribute_used__ __devinitdata
#endif
#ifndef __user
#define __user
#endif
#ifndef SERVICE_ACTION_IN #ifndef SERVICE_ACTION_IN
#define SERVICE_ACTION_IN 0x9e #define SERVICE_ACTION_IN 0x9e
#endif #endif
......
/* gdth_proc.c /* gdth_proc.c
* $Id: gdth_proc.c,v 1.42 2004/03/05 15:50:20 achim Exp $ * $Id: gdth_proc.c,v 1.43 2006/01/11 16:15:00 achim Exp $
*/ */
#include <linux/completion.h> #include <linux/completion.h>
...@@ -51,57 +51,26 @@ int gdth_proc_info(char *buffer,char **start,off_t offset,int length,int hostno, ...@@ -51,57 +51,26 @@ int gdth_proc_info(char *buffer,char **start,off_t offset,int length,int hostno,
static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host,
int hanum,int busnum) int hanum,int busnum)
{ {
int ret_val = -EINVAL; int ret_val = -EINVAL;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
Scsi_Request *scp;
struct scsi_device *sdev;
#else
Scsi_Cmnd *scp;
struct scsi_device *sdev;
#endif
TRACE2(("gdth_set_info() ha %d bus %d\n",hanum,busnum));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) TRACE2(("gdth_set_info() ha %d bus %d\n",hanum,busnum));
sdev = scsi_get_host_dev(host);
scp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!scp)
return -ENOMEM;
scp->sr_cmd_len = 12;
scp->sr_use_sg = 0;
#else
sdev = scsi_get_host_dev(host);
scp = scsi_allocate_device(sdev, 1, FALSE);
if (!scp)
return -ENOMEM;
scp->cmd_len = 12;
scp->use_sg = 0;
#endif
if (length >= 4) { if (length >= 4) {
if (strncmp(buffer,"gdth",4) == 0) { if (strncmp(buffer,"gdth",4) == 0) {
buffer += 5; buffer += 5;
length -= 5; length -= 5;
ret_val = gdth_set_asc_info( buffer, length, hanum, scp ); ret_val = gdth_set_asc_info(host, buffer, length, hanum);
} }
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
scsi_release_request(scp);
scsi_free_host_dev(sdev);
#else
scsi_release_command(scp);
scsi_free_host_dev(sdev);
#endif
return ret_val; return ret_val;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer,
static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Request *scp) int length,int hanum)
#else
static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp)
#endif
{ {
int orig_length, drive, wb_mode; int orig_length, drive, wb_mode;
int i, found; int i, found;
gdth_ha_str *ha; gdth_ha_str *ha;
gdth_cmd_str gdtcmd; gdth_cmd_str gdtcmd;
gdth_cpar_str *pcpar; gdth_cpar_str *pcpar;
...@@ -146,11 +115,8 @@ static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp) ...@@ -146,11 +115,8 @@ static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp)
gdtcmd.u.cache.DeviceNo = i; gdtcmd.u.cache.DeviceNo = i;
gdtcmd.u.cache.BlockNo = 1; gdtcmd.u.cache.BlockNo = 1;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(scp, &gdtcmd, cmnd, 30); gdth_execute(host, &gdtcmd, cmnd, 30, NULL);
#else
gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
#endif
} }
} }
if (!found) if (!found)
...@@ -202,11 +168,9 @@ static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp) ...@@ -202,11 +168,9 @@ static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp)
gdtcmd.u.ioctl.subfunc = CACHE_CONFIG; gdtcmd.u.ioctl.subfunc = CACHE_CONFIG;
gdtcmd.u.ioctl.channel = INVALID_CHANNEL; gdtcmd.u.ioctl.channel = INVALID_CHANNEL;
pcpar->write_back = wb_mode==1 ? 0:1; pcpar->write_back = wb_mode==1 ? 0:1;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(scp, &gdtcmd, cmnd, 30); gdth_execute(host, &gdtcmd, cmnd, 30, NULL);
#else
gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
#endif
gdth_ioctl_free(hanum, GDTH_SCRATCH, ha->pscratch, paddr); gdth_ioctl_free(hanum, GDTH_SCRATCH, ha->pscratch, paddr);
printk("Done.\n"); printk("Done.\n");
return(orig_length); return(orig_length);
...@@ -230,13 +194,6 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -230,13 +194,6 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
gdth_cmd_str *gdtcmd; gdth_cmd_str *gdtcmd;
gdth_evt_str *estr; gdth_evt_str *estr;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
Scsi_Request *scp;
struct scsi_device *sdev;
#else
Scsi_Cmnd *scp;
struct scsi_device *sdev;
#endif
char hrec[161]; char hrec[161];
struct timeval tv; struct timeval tv;
...@@ -252,7 +209,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -252,7 +209,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
gdtcmd = kmalloc(sizeof(*gdtcmd), GFP_KERNEL); gdtcmd = kmalloc(sizeof(*gdtcmd), GFP_KERNEL);
estr = kmalloc(sizeof(*estr), GFP_KERNEL); estr = kmalloc(sizeof(*estr), GFP_KERNEL);
if (!gdtcmd || !estr) if (!gdtcmd || !estr)
goto free_fail; goto free_fail;
memset(cmnd, 0xff, 12); memset(cmnd, 0xff, 12);
memset(gdtcmd, 0, sizeof(gdth_cmd_str)); memset(gdtcmd, 0, sizeof(gdth_cmd_str));
...@@ -260,28 +217,6 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -260,28 +217,6 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
TRACE2(("gdth_get_info() ha %d bus %d\n",hanum,busnum)); TRACE2(("gdth_get_info() ha %d bus %d\n",hanum,busnum));
ha = HADATA(gdth_ctr_tab[hanum]); ha = HADATA(gdth_ctr_tab[hanum]);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
sdev = scsi_get_host_dev(host);
scp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!scp)
goto free_fail;
scp->sr_cmd_len = 12;
scp->sr_use_sg = 0;
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
sdev = scsi_get_host_dev(host);
scp = scsi_allocate_device(sdev, 1, FALSE);
if (!scp)
goto free_fail;
scp->cmd_len = 12;
scp->use_sg = 0;
#else
memset(&sdev,0,sizeof(struct scsi_device));
memset(&scp, 0,sizeof(Scsi_Cmnd));
sdev.host = scp.host = host;
sdev.id = scp.target = sdev.host->this_id;
scp.device = &sdev;
#endif
/* request is i.e. "cat /proc/scsi/gdth/0" */ /* request is i.e. "cat /proc/scsi/gdth/0" */
/* format: %-15s\t%-10s\t%-15s\t%s */ /* format: %-15s\t%-10s\t%-15s\t%s */
...@@ -386,16 +321,9 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -386,16 +321,9 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
sizeof(pds->list[0]); sizeof(pds->list[0]);
if (pds->entries > cnt) if (pds->entries > cnt)
pds->entries = cnt; pds->entries = cnt;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(scp, gdtcmd, cmnd, 30); if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) != S_OK)
if (scp->sr_command->SCp.Status != S_OK)
#else
gdth_do_cmd(scp, gdtcmd, cmnd, 30);
if (scp->SCp.Status != S_OK)
#endif
{
pds->count = 0; pds->count = 0;
}
/* other IOCTLs must fit into area GDTH_SCRATCH/4 */ /* other IOCTLs must fit into area GDTH_SCRATCH/4 */
for (j = 0; j < ha->raw[i].pdev_cnt; ++j) { for (j = 0; j < ha->raw[i].pdev_cnt; ++j) {
...@@ -410,14 +338,8 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -410,14 +338,8 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
gdtcmd->u.ioctl.subfunc = SCSI_DR_INFO | L_CTRL_PATTERN; gdtcmd->u.ioctl.subfunc = SCSI_DR_INFO | L_CTRL_PATTERN;
gdtcmd->u.ioctl.channel = gdtcmd->u.ioctl.channel =
ha->raw[i].address | ha->raw[i].id_list[j]; ha->raw[i].address | ha->raw[i].id_list[j];
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(scp, gdtcmd, cmnd, 30); if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) == S_OK) {
if (scp->sr_command->SCp.Status == S_OK)
#else
gdth_do_cmd(scp, gdtcmd, cmnd, 30);
if (scp->SCp.Status == S_OK)
#endif
{
strncpy(hrec,pdi->vendor,8); strncpy(hrec,pdi->vendor,8);
strncpy(hrec+8,pdi->product,16); strncpy(hrec+8,pdi->product,16);
strncpy(hrec+24,pdi->revision,4); strncpy(hrec+24,pdi->revision,4);
...@@ -466,14 +388,8 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -466,14 +388,8 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
gdtcmd->u.ioctl.channel = gdtcmd->u.ioctl.channel =
ha->raw[i].address | ha->raw[i].id_list[j]; ha->raw[i].address | ha->raw[i].id_list[j];
pdef->sddc_type = 0x08; pdef->sddc_type = 0x08;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
gdth_do_req(scp, gdtcmd, cmnd, 30); if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) == S_OK) {
if (scp->sr_command->SCp.Status == S_OK)
#else
gdth_do_cmd(scp, gdtcmd, cmnd, 30);
if (scp->SCp.Status == S_OK)
#endif
{
size = sprintf(buffer+len, size = sprintf(buffer+len,
" Grown Defects:\t%d\n", " Grown Defects:\t%d\n",
pdef->sddc_cnt); pdef->sddc_cnt);
...@@ -519,16 +435,8 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -519,16 +435,8 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
gdtcmd->u.ioctl.param_size = sizeof(gdth_cdrinfo_str); gdtcmd->u.ioctl.param_size = sizeof(gdth_cdrinfo_str);
gdtcmd->u.ioctl.subfunc = CACHE_DRV_INFO; gdtcmd->u.ioctl.subfunc = CACHE_DRV_INFO;
gdtcmd->u.ioctl.channel = drv_no; gdtcmd->u.ioctl.channel = drv_no;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) != S_OK)
gdth_do_req(scp, gdtcmd, cmnd, 30);
if (scp->sr_command->SCp.Status != S_OK)
#else
gdth_do_cmd(scp, gdtcmd, cmnd, 30);
if (scp->SCp.Status != S_OK)
#endif
{
break; break;
}
pcdi->ld_dtype >>= 16; pcdi->ld_dtype >>= 16;
j++; j++;
if (pcdi->ld_dtype > 2) { if (pcdi->ld_dtype > 2) {
...@@ -629,14 +537,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -629,14 +537,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
gdtcmd->u.ioctl.param_size = sizeof(gdth_arrayinf_str); gdtcmd->u.ioctl.param_size = sizeof(gdth_arrayinf_str);
gdtcmd->u.ioctl.subfunc = ARRAY_INFO | LA_CTRL_PATTERN; gdtcmd->u.ioctl.subfunc = ARRAY_INFO | LA_CTRL_PATTERN;
gdtcmd->u.ioctl.channel = i; gdtcmd->u.ioctl.channel = i;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) == S_OK) {
gdth_do_req(scp, gdtcmd, cmnd, 30);
if (scp->sr_command->SCp.Status == S_OK)
#else
gdth_do_cmd(scp, gdtcmd, cmnd, 30);
if (scp->SCp.Status == S_OK)
#endif
{
if (pai->ai_state == 0) if (pai->ai_state == 0)
strcpy(hrec, "idle"); strcpy(hrec, "idle");
else if (pai->ai_state == 2) else if (pai->ai_state == 2)
...@@ -710,14 +611,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -710,14 +611,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
gdtcmd->u.ioctl.channel = i; gdtcmd->u.ioctl.channel = i;
phg->entries = MAX_HDRIVES; phg->entries = MAX_HDRIVES;
phg->offset = GDTOFFSOF(gdth_hget_str, entry[0]); phg->offset = GDTOFFSOF(gdth_hget_str, entry[0]);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) == S_OK) {
gdth_do_req(scp, gdtcmd, cmnd, 30);
if (scp->sr_command->SCp.Status != S_OK)
#else
gdth_do_cmd(scp, gdtcmd, cmnd, 30);
if (scp->SCp.Status != S_OK)
#endif
{
ha->hdr[i].ldr_no = i; ha->hdr[i].ldr_no = i;
ha->hdr[i].rw_attribs = 0; ha->hdr[i].rw_attribs = 0;
ha->hdr[i].start_sec = 0; ha->hdr[i].start_sec = 0;
...@@ -791,13 +685,6 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -791,13 +685,6 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
} }
stop_output: stop_output:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
scsi_release_request(scp);
scsi_free_host_dev(sdev);
#else
scsi_release_command(scp);
scsi_free_host_dev(sdev);
#endif
*start = buffer +(offset-begin); *start = buffer +(offset-begin);
len -= (offset-begin); len -= (offset-begin);
if (len > length) if (len > length)
...@@ -812,64 +699,6 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, ...@@ -812,64 +699,6 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
return rc; return rc;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
static void gdth_do_req(Scsi_Request *scp, gdth_cmd_str *gdtcmd,
char *cmnd, int timeout)
{
unsigned bufflen;
DECLARE_COMPLETION(wait);
TRACE2(("gdth_do_req()\n"));
if (gdtcmd != NULL) {
bufflen = sizeof(gdth_cmd_str);
} else {
bufflen = 0;
}
scp->sr_request->rq_status = RQ_SCSI_BUSY;
scp->sr_request->waiting = &wait;
scsi_do_req(scp, cmnd, gdtcmd, bufflen, gdth_scsi_done, timeout*HZ, 1);
wait_for_completion(&wait);
}
#else
static void gdth_do_cmd(Scsi_Cmnd *scp, gdth_cmd_str *gdtcmd,
char *cmnd, int timeout)
{
unsigned bufflen;
DECLARE_COMPLETION(wait);
TRACE2(("gdth_do_cmd()\n"));
if (gdtcmd != NULL) {
scp->SCp.this_residual = IOCTL_PRI;
bufflen = sizeof(gdth_cmd_str);
} else {
scp->SCp.this_residual = DEFAULT_PRI;
bufflen = 0;
}
scp->request.rq_status = RQ_SCSI_BUSY;
scp->request.waiting = &wait;
scsi_do_cmd(scp, cmnd, gdtcmd, bufflen, gdth_scsi_done, timeout*HZ, 1);
wait_for_completion(&wait);
}
#endif
void gdth_scsi_done(Scsi_Cmnd *scp)
{
TRACE2(("gdth_scsi_done()\n"));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
scp->request->rq_status = RQ_SCSI_DONE;
if (scp->request->waiting != NULL)
complete(scp->request->waiting);
#else
scp->request.rq_status = RQ_SCSI_DONE;
if (scp->request.waiting != NULL)
complete(scp->request.waiting);
#endif
}
static char *gdth_ioctl_alloc(int hanum, int size, int scratch, static char *gdth_ioctl_alloc(int hanum, int size, int scratch,
ulong64 *paddr) ulong64 *paddr)
{ {
...@@ -976,11 +805,14 @@ static void gdth_stop_timeout(int hanum, int busnum, int id) ...@@ -976,11 +805,14 @@ static void gdth_stop_timeout(int hanum, int busnum, int id)
spin_lock_irqsave(&ha->smp_lock, flags); spin_lock_irqsave(&ha->smp_lock, flags);
for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; if (scp->done != gdth_scsi_done) {
t = scp->device->id; b = virt_ctr ?
if (t == (unchar)id && b == (unchar)busnum) { NUMDATA(scp->device->host)->busnum : scp->device->channel;
TRACE2(("gdth_stop_timeout(): update_timeout()\n")); t = scp->device->id;
scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0); if (t == (unchar)id && b == (unchar)busnum) {
TRACE2(("gdth_stop_timeout(): update_timeout()\n"));
scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0);
}
} }
} }
spin_unlock_irqrestore(&ha->smp_lock, flags); spin_unlock_irqrestore(&ha->smp_lock, flags);
...@@ -997,11 +829,14 @@ static void gdth_start_timeout(int hanum, int busnum, int id) ...@@ -997,11 +829,14 @@ static void gdth_start_timeout(int hanum, int busnum, int id)
spin_lock_irqsave(&ha->smp_lock, flags); spin_lock_irqsave(&ha->smp_lock, flags);
for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; if (scp->done != gdth_scsi_done) {
t = scp->device->id; b = virt_ctr ?
if (t == (unchar)id && b == (unchar)busnum) { NUMDATA(scp->device->host)->busnum : scp->device->channel;
TRACE2(("gdth_start_timeout(): update_timeout()\n")); t = scp->device->id;
gdth_update_timeout(hanum, scp, scp->SCp.buffers_residual); if (t == (unchar)id && b == (unchar)busnum) {
TRACE2(("gdth_start_timeout(): update_timeout()\n"));
gdth_update_timeout(hanum, scp, scp->SCp.buffers_residual);
}
} }
} }
spin_unlock_irqrestore(&ha->smp_lock, flags); spin_unlock_irqrestore(&ha->smp_lock, flags);
......
...@@ -5,20 +5,16 @@ ...@@ -5,20 +5,16 @@
* $Id: gdth_proc.h,v 1.16 2004/01/14 13:09:01 achim Exp $ * $Id: gdth_proc.h,v 1.16 2004/01/14 13:09:01 achim Exp $
*/ */
int gdth_execute(struct Scsi_Host *shost, gdth_cmd_str *gdtcmd, char *cmnd,
int timeout, u32 *info);
static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host,
int hanum,int busnum); int hanum,int busnum);
static int gdth_get_info(char *buffer,char **start,off_t offset,int length, static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
struct Scsi_Host *host,int hanum,int busnum); struct Scsi_Host *host,int hanum,int busnum);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer,
static void gdth_do_req(Scsi_Request *srp, gdth_cmd_str *cmd, int length, int hanum);
char *cmnd, int timeout);
static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Request *scp);
#else
static void gdth_do_cmd(Scsi_Cmnd *scp, gdth_cmd_str *cmd,
char *cmnd, int timeout);
static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp);
#endif
static char *gdth_ioctl_alloc(int hanum, int size, int scratch, static char *gdth_ioctl_alloc(int hanum, int size, int scratch,
ulong64 *paddr); ulong64 *paddr);
...@@ -28,7 +24,5 @@ static void gdth_stop_timeout(int hanum, int busnum, int id); ...@@ -28,7 +24,5 @@ static void gdth_stop_timeout(int hanum, int busnum, int id);
static void gdth_start_timeout(int hanum, int busnum, int id); static void gdth_start_timeout(int hanum, int busnum, int id);
static int gdth_update_timeout(int hanum, Scsi_Cmnd *scp, int timeout); static int gdth_update_timeout(int hanum, Scsi_Cmnd *scp, int timeout);
void gdth_scsi_done(Scsi_Cmnd *scp);
#endif #endif
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