Commit f020644d authored by James Bottomley's avatar James Bottomley Committed by Christoph Hellwig

MPT Fusion driver 3.01.07 update

From: "Moore, Eric Dean" <Emoore@lsil.com>

Clean up backword compatibility with 2.4 kernel and older. Patch
provided by Christoph Hellwig<hch@lst.de,hch@infradead.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 8e742162
...@@ -56,14 +56,6 @@ ...@@ -56,14 +56,6 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/io.h> #include <asm/io.h>
#if defined (__sparc__)
#include <linux/timer.h>
#endif
/* Hmmm, avoid undefined spinlock_t on lk-2.2.14-5.0 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
#include <asm/spinlock.h>
#endif
#define MODULEAUTHOR "Steven J. Ralston" #define MODULEAUTHOR "Steven J. Ralston"
#define COPYRIGHT "Copyright (c) 2001-2004 " MODULEAUTHOR #define COPYRIGHT "Copyright (c) 2001-2004 " MODULEAUTHOR
......
...@@ -2,196 +2,7 @@ ...@@ -2,196 +2,7 @@
#ifndef FUSION_LINUX_COMPAT_H #ifndef FUSION_LINUX_COMPAT_H
#define FUSION_LINUX_COMPAT_H #define FUSION_LINUX_COMPAT_H
/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#include <linux/version.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/pci.h>
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#ifndef rwlock_init
#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0)
#endif
#define SET_NICE(current,x) do {(current)->nice = (x);} while (0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
# if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)
typedef unsigned int dma_addr_t;
# endif
#else
# if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,42)
typedef unsigned int dma_addr_t;
# endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)
/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* This block snipped from lk-2.2.18/include/linux/init.h { */
/*
* Used for initialization calls..
*/
typedef int (*initcall_t)(void);
typedef void (*exitcall_t)(void);
#define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
#define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit")))
extern initcall_t __initcall_start, __initcall_end;
#define __initcall(fn) \
static initcall_t __initcall_##fn __init_call = fn
#define __exitcall(fn) \
static exitcall_t __exitcall_##fn __exit_call = fn
#ifdef MODULE
/* These macros create a dummy inline: gcc 2.9x does not count alias
as usage, hence the `unused function' warning when __init functions
are declared static. We use the dummy __*_module_inline functions
both to kill the warning and check the type of the init/cleanup
function. */
typedef int (*__init_module_func_t)(void);
typedef void (*__cleanup_module_func_t)(void);
#define module_init(x) \
int init_module(void) __attribute__((alias(#x))); \
static inline __init_module_func_t __init_module_inline(void) \
{ return x; }
#define module_exit(x) \
void cleanup_module(void) __attribute__((alias(#x))); \
static inline __cleanup_module_func_t __cleanup_module_inline(void) \
{ return x; }
#else
#define module_init(x) __initcall(x);
#define module_exit(x) __exitcall(x);
#endif
/* } block snipped from lk-2.2.18/include/linux/init.h */
/* This block snipped from lk-2.2.18/include/linux/sched.h { */
/*
* Used prior to schedule_timeout calls..
*/
#define __set_current_state(state_value) do { current->state = state_value; } while (0)
#ifdef CONFIG_SMP
#define set_current_state(state_value) do { __set_current_state(state_value); mb(); } while (0)
#else
#define set_current_state(state_value) __set_current_state(state_value)
#endif
/* } block snipped from lk-2.2.18/include/linux/sched.h */
/* procfs compat stuff... */
#define proc_mkdir(x,y) create_proc_entry(x, S_IFDIR, y)
/* MUTEX compat stuff... */
#define DECLARE_MUTEX(name) struct semaphore name=MUTEX
#define DECLARE_MUTEX_LOCKED(name) struct semaphore name=MUTEX_LOCKED
#define init_MUTEX(x) *(x)=MUTEX
#define init_MUTEX_LOCKED(x) *(x)=MUTEX_LOCKED
/* Wait queues. */
#define DECLARE_WAIT_QUEUE_HEAD(name) \
struct wait_queue * (name) = NULL
#define DECLARE_WAITQUEUE(name, task) \
struct wait_queue (name) = { (task), NULL }
#if defined(__sparc__) && defined(__sparc_v9__)
/* The sparc64 ioremap implementation is wrong in 2.2.x,
* but fixing it would break all of the drivers which
* workaround it. Fixed in 2.3.x onward. -DaveM
*/
#define ARCH_IOREMAP(base) ((unsigned long) (base))
#else
#define ARCH_IOREMAP(base) ioremap(base)
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#else /* LINUX_VERSION_CODE must be >= KERNEL_VERSION(2,2,18) */
/* No ioremap bugs in >2.3.x kernels. */
#define ARCH_IOREMAP(base) ioremap(base)
/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) */
/*
* Inclined to use:
* #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
* here, but MODULE_LICENSE defined in 2.4.9-6 and 2.4.9-13
* breaks the rule:-(
*/
#ifndef MODULE_LICENSE
#define MODULE_LICENSE(license)
#endif
/* PCI/driver subsystem { */
#define PCI_BASEADDR_FLAGS(idx) resource[idx].flags
#define PCI_BASEADDR_START(idx) resource[idx].start
#define PCI_BASEADDR_SIZE(dev,idx) (dev)->resource[idx].end - (dev)->resource[idx].start + 1
/* Compatability for the 2.3.x PCI DMA API. */
#ifndef PCI_DMA_BIDIRECTIONAL
/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#define PCI_DMA_BIDIRECTIONAL 0
#define PCI_DMA_TODEVICE 1
#define PCI_DMA_FROMDEVICE 2
#define PCI_DMA_NONE 3
#ifdef __KERNEL__
#include <asm/page.h>
/* Pure 2^n version of get_order */
static __inline__ int __get_order(unsigned long size)
{
int order;
size = (size-1) >> (PAGE_SHIFT-1);
order = -1;
do {
size >>= 1;
order++;
} while (size);
return order;
}
#endif
#define pci_alloc_consistent(hwdev, size, dma_handle) \
({ void *__ret = (void *)__get_free_pages(GFP_ATOMIC, __get_order(size)); \
if (__ret != NULL) { \
memset(__ret, 0, size); \
*(dma_handle) = virt_to_bus(__ret); \
} \
__ret; \
})
#define pci_free_consistent(hwdev, size, vaddr, dma_handle) \
free_pages((unsigned long)vaddr, __get_order(size))
#define pci_map_single(hwdev, ptr, size, direction) \
virt_to_bus(ptr);
#define pci_unmap_single(hwdev, dma_addr, size, direction) \
do { /* Nothing to do */ } while (0)
#define pci_map_sg(hwdev, sg, nents, direction) (nents)
#define pci_unmap_sg(hwdev, sg, nents, direction) \
do { /* Nothing to do */ } while(0)
#define sg_dma_address(sg) (virt_to_bus((sg)->address))
#define sg_dma_len(sg) ((sg)->length)
/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#endif /* PCI_DMA_BIDIRECTIONAL */
#define mpt_work_struct work_struct
#define MPT_INIT_WORK(_task, _func, _data) INIT_WORK(_task, _func, _data)
#define mpt_sync_irq(_irq) synchronize_irq(_irq)
/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#endif /* _LINUX_COMPAT_H */ #endif /* _LINUX_COMPAT_H */
...@@ -1311,14 +1311,14 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1311,14 +1311,14 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
mem_phys = msize = 0; mem_phys = msize = 0;
port = psize = 0; port = psize = 0;
for (ii=0; ii < DEVICE_COUNT_RESOURCE; ii++) { for (ii=0; ii < DEVICE_COUNT_RESOURCE; ii++) {
if (pdev->PCI_BASEADDR_FLAGS(ii) & PCI_BASE_ADDRESS_SPACE_IO) { if (pci_resource_flags(pdev, ii) & PCI_BASE_ADDRESS_SPACE_IO) {
/* Get I/O space! */ /* Get I/O space! */
port = pdev->PCI_BASEADDR_START(ii); port = pci_resource_start(pdev, ii);
psize = PCI_BASEADDR_SIZE(pdev,ii); psize = pci_resource_len(pdev,ii);
} else { } else {
/* Get memmap */ /* Get memmap */
mem_phys = pdev->PCI_BASEADDR_START(ii); mem_phys = pci_resource_start(pdev, ii);
msize = PCI_BASEADDR_SIZE(pdev,ii); msize = pci_resource_len(pdev,ii);
break; break;
} }
} }
...@@ -1524,7 +1524,7 @@ mptbase_remove(struct pci_dev *pdev) ...@@ -1524,7 +1524,7 @@ mptbase_remove(struct pci_dev *pdev)
CHIPREG_WRITE32(&ioc->chip->IntMask, 0xFFFFFFFF); CHIPREG_WRITE32(&ioc->chip->IntMask, 0xFFFFFFFF);
ioc->active = 0; ioc->active = 0;
mpt_sync_irq(pdev->irq); synchronize_irq(pdev->irq);
/* Clear any lingering interrupt */ /* Clear any lingering interrupt */
CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
...@@ -3799,7 +3799,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc) ...@@ -3799,7 +3799,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
/* Prime reply FIFO... */ /* Prime reply FIFO... */
dprintk((KERN_INFO MYNAM ": %s.reply_alloc @ %p[%p], sz=%d bytes\n", dprintk((KERN_INFO MYNAM ": %s.reply_alloc @ %p[%p], sz=%d bytes\n",
ioc->name, mem, (void *)(ulong)ioc->reply_alloc_dma, reply_buffer_sz)); ioc->name, ioc->reply_alloc,
(void *)(ulong)ioc->reply_alloc_dma, reply_buffer_sz));
b = (unsigned long) ioc->reply_alloc; b = (unsigned long) ioc->reply_alloc;
b = (b + (0x80UL - 1UL)) & ~(0x80UL - 1UL); /* round up to 128-byte boundary */ b = (b + (0x80UL - 1UL)) & ~(0x80UL - 1UL); /* round up to 128-byte boundary */
...@@ -3812,7 +3813,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc) ...@@ -3812,7 +3813,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
/* Request FIFO - WE manage this! */ /* Request FIFO - WE manage this! */
dprintk((KERN_INFO MYNAM ": %s.req_alloc @ %p[%p], sz=%d bytes\n", dprintk((KERN_INFO MYNAM ": %s.req_alloc @ %p[%p], sz=%d bytes\n",
ioc->name, mem, (void *)(ulong)ioc->req_alloc_dma, request_buffer_sz)); ioc->name, ioc->req_alloc,
(void *)(ulong)ioc->req_alloc_dma, request_buffer_sz));
b = (unsigned long) ioc->req_alloc; b = (unsigned long) ioc->req_alloc;
b = (b + (0x80UL - 1UL)) & ~(0x80UL - 1UL); /* round up to 128-byte boundary */ b = (b + (0x80UL - 1UL)) & ~(0x80UL - 1UL); /* round up to 128-byte boundary */
......
...@@ -55,7 +55,11 @@ ...@@ -55,7 +55,11 @@
#define MPTBASE_H_INCLUDED #define MPTBASE_H_INCLUDED
/*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#include "linux_compat.h" /* linux-2.2.x (vs. -2.4.x) tweaks */ #include <linux/version.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include "scsi3.h" /* SCSI defines */ #include "scsi3.h" /* SCSI defines */
#include "lsi/mpi_type.h" #include "lsi/mpi_type.h"
...@@ -81,8 +85,8 @@ ...@@ -81,8 +85,8 @@
#define COPYRIGHT "Copyright (c) 1999-2004 " MODULEAUTHOR #define COPYRIGHT "Copyright (c) 1999-2004 " MODULEAUTHOR
#endif #endif
#define MPT_LINUX_VERSION_COMMON "3.01.06" #define MPT_LINUX_VERSION_COMMON "3.01.07"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.06" #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.07"
#define WHAT_MAGIC_STRING "@" "(" "#" ")" #define WHAT_MAGIC_STRING "@" "(" "#" ")"
#define show_mptmod_ver(s,ver) \ #define show_mptmod_ver(s,ver) \
......
...@@ -102,9 +102,6 @@ ...@@ -102,9 +102,6 @@
#define my_VERSION MPT_LINUX_VERSION_COMMON #define my_VERSION MPT_LINUX_VERSION_COMMON
#define MYNAM "mptctl" #define MYNAM "mptctl"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,62)
EXPORT_NO_SYMBOLS;
#endif
MODULE_AUTHOR(MODULEAUTHOR); MODULE_AUTHOR(MODULEAUTHOR);
MODULE_DESCRIPTION(my_NAME); MODULE_DESCRIPTION(my_NAME);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -545,38 +542,6 @@ mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) ...@@ -545,38 +542,6 @@ mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
return 1; return 1;
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
* struct file_operations functionality.
* Members:
* llseek, write, read, ioctl, open, release
*/
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9)
static loff_t
mptctl_llseek(struct file *file, loff_t offset, int origin)
{
return -ESPIPE;
}
#define no_llseek mptctl_llseek
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static ssize_t
mptctl_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
{
printk(KERN_ERR MYNAM ": ioctl WRITE not yet supported\n");
return 0;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static ssize_t
mptctl_read(struct file *file, char *buf, size_t count, loff_t *ptr)
{
printk(KERN_ERR MYNAM ": ioctl READ not yet supported\n");
return 0;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
* MPT ioctl handler * MPT ioctl handler
...@@ -699,21 +664,6 @@ static int mptctl_do_reset(unsigned long arg) ...@@ -699,21 +664,6 @@ static int mptctl_do_reset(unsigned long arg)
return 0; return 0;
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static int mptctl_open(struct inode *inode, struct file *file)
{
/*
* Should support multiple management users
*/
return 0;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static int mptctl_release(struct inode *inode, struct file *file)
{
return 0;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
* MPT FW download function. Cast the arg into the mpt_fw_xfer structure. * MPT FW download function. Cast the arg into the mpt_fw_xfer structure.
...@@ -1278,10 +1228,8 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) ...@@ -1278,10 +1228,8 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
karg->pciId = pdev->device; karg->pciId = pdev->device;
pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
karg->hwRev = revision; karg->hwRev = revision;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
karg->subSystemDevice = pdev->subsystem_device; karg->subSystemDevice = pdev->subsystem_device;
karg->subSystemVendor = pdev->subsystem_vendor; karg->subSystemVendor = pdev->subsystem_vendor;
#endif
if (cim_rev == 1) { if (cim_rev == 1) {
/* Get the PCI bus, device, and function numbers for the IOC /* Get the PCI bus, device, and function numbers for the IOC
...@@ -2455,10 +2403,8 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) ...@@ -2455,10 +2403,8 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
karg.vendor = pdev->vendor; karg.vendor = pdev->vendor;
karg.device = pdev->device; karg.device = pdev->device;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
karg.subsystem_id = pdev->subsystem_device; karg.subsystem_id = pdev->subsystem_device;
karg.subsystem_vendor = pdev->subsystem_vendor; karg.subsystem_vendor = pdev->subsystem_vendor;
#endif
karg.devfn = pdev->devfn; karg.devfn = pdev->devfn;
karg.bus = pdev->bus->number; karg.bus = pdev->bus->number;
...@@ -2540,7 +2486,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) ...@@ -2540,7 +2486,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
break; break;
} }
karg.base_io_addr = pdev->PCI_BASEADDR_START(0); karg.base_io_addr = pci_resource_start(pdev, 0);
if ((int)ioc->chip_type <= (int) FC929) if ((int)ioc->chip_type <= (int) FC929)
karg.bus_phys_width = HP_BUS_WIDTH_UNK; karg.bus_phys_width = HP_BUS_WIDTH_UNK;
...@@ -2739,20 +2685,10 @@ mptctl_hp_targetinfo(unsigned long arg) ...@@ -2739,20 +2685,10 @@ mptctl_hp_targetinfo(unsigned long arg)
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,51)
#define owner_THIS_MODULE .owner = THIS_MODULE,
#else
#define owner_THIS_MODULE
#endif
static struct file_operations mptctl_fops = { static struct file_operations mptctl_fops = {
owner_THIS_MODULE .owner = THIS_MODULE,
.llseek = no_llseek, .llseek = no_llseek,
.read = mptctl_read,
.write = mptctl_write,
.ioctl = mptctl_ioctl, .ioctl = mptctl_ioctl,
.open = mptctl_open,
.release = mptctl_release,
}; };
static struct miscdevice mptctl_miscdev = { static struct miscdevice mptctl_miscdev = {
......
...@@ -133,7 +133,7 @@ struct mpt_lan_priv { ...@@ -133,7 +133,7 @@ struct mpt_lan_priv {
u32 total_received; u32 total_received;
struct net_device_stats stats; /* Per device statistics */ struct net_device_stats stats; /* Per device statistics */
struct mpt_work_struct post_buckets_task; struct work_struct post_buckets_task;
unsigned long post_buckets_active; unsigned long post_buckets_active;
}; };
...@@ -880,18 +880,9 @@ mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority) ...@@ -880,18 +880,9 @@ mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority)
if (test_and_set_bit(0, &priv->post_buckets_active) == 0) { if (test_and_set_bit(0, &priv->post_buckets_active) == 0) {
if (priority) { if (priority) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
schedule_work(&priv->post_buckets_task); schedule_work(&priv->post_buckets_task);
#else
queue_task(&priv->post_buckets_task, &tq_immediate);
mark_bh(IMMEDIATE_BH);
#endif
} else { } else {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
schedule_delayed_work(&priv->post_buckets_task, 1); schedule_delayed_work(&priv->post_buckets_task, 1);
#else
queue_task(&priv->post_buckets_task, &tq_timer);
#endif
dioprintk((KERN_INFO MYNAM ": post_buckets queued on " dioprintk((KERN_INFO MYNAM ": post_buckets queued on "
"timer.\n")); "timer.\n"));
} }
...@@ -1391,8 +1382,8 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum) ...@@ -1391,8 +1382,8 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
priv->mpt_dev = mpt_dev; priv->mpt_dev = mpt_dev;
priv->pnum = pnum; priv->pnum = pnum;
memset(&priv->post_buckets_task, 0, sizeof(struct mpt_work_struct)); memset(&priv->post_buckets_task, 0, sizeof(struct work_struct));
MPT_INIT_WORK(&priv->post_buckets_task, mpt_lan_post_receive_buckets, dev); INIT_WORK(&priv->post_buckets_task, mpt_lan_post_receive_buckets, dev);
priv->post_buckets_active = 0; priv->post_buckets_active = 0;
dlprintk((KERN_INFO MYNAM "@%d: bucketlen = %d\n", dlprintk((KERN_INFO MYNAM "@%d: bucketlen = %d\n",
...@@ -1566,10 +1557,6 @@ static void __exit mpt_lan_exit(void) ...@@ -1566,10 +1557,6 @@ static void __exit mpt_lan_exit(void)
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,59)
MODULE_PARM(tx_max_out_p, "i");
MODULE_PARM(max_buckets_out, "i"); // Debug stuff. FIXME!
#endif
module_init(mpt_lan_init); module_init(mpt_lan_init);
module_exit(mpt_lan_exit); module_exit(mpt_lan_exit);
......
...@@ -74,6 +74,8 @@ ...@@ -74,6 +74,8 @@
#include <linux/delay.h> /* for mdelay */ #include <linux/delay.h> /* for mdelay */
#include <linux/interrupt.h> /* needed for in_interrupt() proto */ #include <linux/interrupt.h> /* needed for in_interrupt() proto */
#include <linux/reboot.h> /* notifier code */ #include <linux/reboot.h> /* notifier code */
#include <linux/sched.h>
#include <linux/workqueue.h>
#include "../../scsi/scsi.h" #include "../../scsi/scsi.h"
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
...@@ -185,7 +187,7 @@ static void mptscsih_schedule_reset(void *hd); ...@@ -185,7 +187,7 @@ static void mptscsih_schedule_reset(void *hd);
static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd); static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd);
static int mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum); static int mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum);
static struct mpt_work_struct mptscsih_rstTask; static struct work_struct mptscsih_rstTask;
#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io); static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io);
...@@ -231,7 +233,7 @@ static int ScsiScanDvCtx = -1; /* Used only for bus scan and dv */ ...@@ -231,7 +233,7 @@ static int ScsiScanDvCtx = -1; /* Used only for bus scan and dv */
static spinlock_t dvtaskQ_lock = SPIN_LOCK_UNLOCKED; static spinlock_t dvtaskQ_lock = SPIN_LOCK_UNLOCKED;
static int dvtaskQ_active = 0; static int dvtaskQ_active = 0;
static int dvtaskQ_release = 0; static int dvtaskQ_release = 0;
static struct mpt_work_struct mptscsih_dvTask; static struct work_struct mptscsih_dvTask;
#endif #endif
/* /*
...@@ -249,31 +251,7 @@ static struct mptscsih_driver_setup ...@@ -249,31 +251,7 @@ static struct mptscsih_driver_setup
static Scsi_Cmnd *foo_to[8]; static Scsi_Cmnd *foo_to[8];
#endif #endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ static struct scsi_host_template driver_template;
/* see mptscsih.h */
static struct scsi_host_template driver_template = {
.proc_name = "mptscsih",
.proc_info = x_scsi_proc_info,
.name = "MPT SCSI Host",
.info = x_scsi_info,
.queuecommand = x_scsi_queuecommand,
.slave_alloc = x_scsi_slave_alloc,
.slave_configure = x_scsi_slave_configure,
.slave_destroy = x_scsi_slave_destroy,
.eh_abort_handler = x_scsi_abort,
.eh_device_reset_handler = x_scsi_dev_reset,
.eh_bus_reset_handler = x_scsi_bus_reset,
.eh_host_reset_handler = x_scsi_host_reset,
.bios_param = x_scsi_bios_param,
.can_queue = MPT_SCSI_CAN_QUEUE,
.this_id = -1,
.sg_tablesize = MPT_SCSI_SG_DEPTH,
.max_sectors = MPT_SCSI_MAX_SECTORS,
.cmd_per_lun = MPT_SCSI_CMD_PER_LUN,
.use_clustering = ENABLE_CLUSTERING,
};
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
...@@ -1459,7 +1437,6 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1459,7 +1437,6 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
} }
sh->max_lun = MPT_LAST_LUN + 1; sh->max_lun = MPT_LAST_LUN + 1;
sh->max_sectors = MPT_SCSI_MAX_SECTORS;
sh->max_channel = 0; sh->max_channel = 0;
sh->this_id = ioc->pfacts[0].PortSCSIID; sh->this_id = ioc->pfacts[0].PortSCSIID;
...@@ -1800,8 +1777,8 @@ mptscsih_remove(struct pci_dev *pdev) ...@@ -1800,8 +1777,8 @@ mptscsih_remove(struct pci_dev *pdev)
} }
dprintk((MYIOC_s_INFO_FMT dprintk((MYIOC_s_INFO_FMT
"Free'd ScsiLookup (%d), chain (%d) and Target (%d+%d) memory\n", "Free'd ScsiLookup (%d) Target (%d+%d) memory\n",
hd->ioc->name, sz1, szchain, sz3, sztarget)); hd->ioc->name, sz1, sz3, sztarget));
dprintk(("Free'd done and free Q (%d) memory\n", szQ)); dprintk(("Free'd done and free Q (%d) memory\n", szQ));
/* NULL the Scsi_Host pointer /* NULL the Scsi_Host pointer
...@@ -1879,9 +1856,9 @@ mptscsih_resume(struct pci_dev *pdev) ...@@ -1879,9 +1856,9 @@ mptscsih_resume(struct pci_dev *pdev)
if (!dvtaskQ_active) { if (!dvtaskQ_active) {
dvtaskQ_active = 1; dvtaskQ_active = 1;
spin_unlock_irqrestore(&dvtaskQ_lock, lflags); spin_unlock_irqrestore(&dvtaskQ_lock, lflags);
MPT_INIT_WORK(&mptscsih_dvTask, INIT_WORK(&mptscsih_dvTask,
mptscsih_domainValidation, (void *) hd); mptscsih_domainValidation, (void *) hd);
SCHEDULE_TASK(&mptscsih_dvTask); schedule_work(&mptscsih_dvTask);
} else { } else {
spin_unlock_irqrestore(&dvtaskQ_lock, lflags); spin_unlock_irqrestore(&dvtaskQ_lock, lflags);
} }
...@@ -1902,7 +1879,6 @@ static struct mpt_pci_driver mptscsih_driver = { ...@@ -1902,7 +1879,6 @@ static struct mpt_pci_driver mptscsih_driver = {
#endif #endif
}; };
/* SCSI host fops start here... */ /* SCSI host fops start here... */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/** /**
...@@ -2434,9 +2410,9 @@ mptscsih_qcmd(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) ...@@ -2434,9 +2410,9 @@ mptscsih_qcmd(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
if (!dvtaskQ_active) { if (!dvtaskQ_active) {
dvtaskQ_active = 1; dvtaskQ_active = 1;
spin_unlock_irqrestore(&dvtaskQ_lock, lflags); spin_unlock_irqrestore(&dvtaskQ_lock, lflags);
MPT_INIT_WORK(&mptscsih_dvTask, mptscsih_domainValidation, (void *) hd); INIT_WORK(&mptscsih_dvTask, mptscsih_domainValidation, (void *) hd);
SCHEDULE_TASK(&mptscsih_dvTask); schedule_work(&mptscsih_dvTask);
} else { } else {
spin_unlock_irqrestore(&dvtaskQ_lock, lflags); spin_unlock_irqrestore(&dvtaskQ_lock, lflags);
} }
...@@ -3905,6 +3881,29 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) ...@@ -3905,6 +3881,29 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
return 1; /* currently means nothing really */ return 1; /* currently means nothing really */
} }
static struct scsi_host_template driver_template = {
.proc_name = "mptscsih",
.proc_info = mptscsih_proc_info,
.name = "MPT SCSI Host",
.info = mptscsih_info,
.queuecommand = mptscsih_qcmd,
.slave_alloc = mptscsih_slave_alloc,
.slave_configure = mptscsih_slave_configure,
.slave_destroy = mptscsih_slave_destroy,
.eh_abort_handler = mptscsih_abort,
.eh_device_reset_handler = mptscsih_dev_reset,
.eh_bus_reset_handler = mptscsih_bus_reset,
.eh_host_reset_handler = mptscsih_host_reset,
.bios_param = mptscsih_bios_param,
.can_queue = MPT_SCSI_CAN_QUEUE,
.this_id = -1,
.sg_tablesize = MPT_SCSI_SG_DEPTH,
.max_sectors = 8192,
.cmd_per_lun = 7,
.use_clustering = ENABLE_CLUSTERING,
};
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
* Private data... * Private data...
...@@ -4950,8 +4949,8 @@ static void mptscsih_taskmgmt_timeout(unsigned long data) ...@@ -4950,8 +4949,8 @@ static void mptscsih_taskmgmt_timeout(unsigned long data)
/* Call the reset handler. Already had a TM request /* Call the reset handler. Already had a TM request
* timeout - so issue a diagnostic reset * timeout - so issue a diagnostic reset
*/ */
MPT_INIT_WORK(&mptscsih_rstTask, mptscsih_schedule_reset, (void *)hd); INIT_WORK(&mptscsih_rstTask, mptscsih_schedule_reset, (void *)hd);
SCHEDULE_TASK(&mptscsih_rstTask); schedule_work(&mptscsih_rstTask);
return; return;
} }
......
...@@ -108,75 +108,4 @@ struct mptscsih_driver_setup ...@@ -108,75 +108,4 @@ struct mptscsih_driver_setup
MPTSCSIH_SAF_TE, \ MPTSCSIH_SAF_TE, \
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
* Various bits and pieces broke within the lk-2.4.0-testN series:-(
* So here are various HACKS to work around them.
*/
/*
* tq_scheduler disappeared @ lk-2.4.0-test12
* (right when <linux/sched.h> newly defined TQ_ACTIVE)
* tq_struct reworked in 2.5.41. Include workqueue.h.
*/
# include <linux/sched.h>
# include <linux/workqueue.h>
#define SCHEDULE_TASK(x) \
if (schedule_work(x) == 0) { \
/*MOD_DEC_USE_COUNT*/; \
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#define x_scsi_info mptscsih_info
#define x_scsi_queuecommand mptscsih_qcmd
#define x_scsi_abort mptscsih_abort
#define x_scsi_bus_reset mptscsih_bus_reset
#define x_scsi_dev_reset mptscsih_dev_reset
#define x_scsi_host_reset mptscsih_host_reset
#define x_scsi_bios_param mptscsih_bios_param
#define x_scsi_slave_alloc mptscsih_slave_alloc
#define x_scsi_slave_configure mptscsih_slave_configure
#define x_scsi_slave_destroy mptscsih_slave_destroy
#define x_scsi_proc_info mptscsih_proc_info
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
* MPT SCSI Host / Initiator decls...
*/
extern const char *x_scsi_info(struct Scsi_Host *);
extern int x_scsi_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
extern int x_scsi_abort(Scsi_Cmnd *);
extern int x_scsi_bus_reset(Scsi_Cmnd *);
extern int x_scsi_dev_reset(Scsi_Cmnd *);
extern int x_scsi_host_reset(Scsi_Cmnd *);
extern int x_scsi_bios_param(struct scsi_device * sdev, struct block_device *bdev,
sector_t capacity, int geom[]);
extern int x_scsi_slave_alloc(Scsi_Device *);
extern int x_scsi_slave_configure(Scsi_Device *);
extern void x_scsi_slave_destroy(Scsi_Device *);
extern int x_scsi_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* include/scsi/scsi.h may not be quite complete... */
#ifndef RESERVE_10
#define RESERVE_10 0x56
#endif
#ifndef RELEASE_10
#define RELEASE_10 0x57
#endif
#ifndef PERSISTENT_RESERVE_IN
#define PERSISTENT_RESERVE_IN 0x5e
#endif #endif
#ifndef PERSISTENT_RESERVE_OUT
#define PERSISTENT_RESERVE_OUT 0x5f
#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