Commit 8a7e4c24 authored by Sreekanth Reddy's avatar Sreekanth Reddy Committed by Martin K. Petersen

mpt3sas: Added mpt2sas driver definitions

1. Added mpt2sas driver related macros in mpt3sas header files

2. Made scsi host's, raid class', pci's, ioctl's callback functions
global so that both drivers can use them.
Signed-off-by: default avatarSreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Acked-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 3c586656
...@@ -2855,15 +2855,15 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc, int sleep_flag) ...@@ -2855,15 +2855,15 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
else else
sg_tablesize = MPT3SAS_SG_DEPTH; sg_tablesize = MPT3SAS_SG_DEPTH;
if (sg_tablesize < MPT3SAS_MIN_PHYS_SEGMENTS) if (sg_tablesize < MPT_MIN_PHYS_SEGMENTS)
sg_tablesize = MPT3SAS_MIN_PHYS_SEGMENTS; sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
else if (sg_tablesize > MPT3SAS_MAX_PHYS_SEGMENTS) { else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
sg_tablesize = min_t(unsigned short, sg_tablesize, sg_tablesize = min_t(unsigned short, sg_tablesize,
SCSI_MAX_SG_CHAIN_SEGMENTS); SCSI_MAX_SG_CHAIN_SEGMENTS);
pr_warn(MPT3SAS_FMT pr_warn(MPT3SAS_FMT
"sg_tablesize(%u) is bigger than kernel" "sg_tablesize(%u) is bigger than kernel"
" defined SCSI_MAX_SG_SEGMENTS(%u)\n", ioc->name, " defined SCSI_MAX_SG_SEGMENTS(%u)\n", ioc->name,
sg_tablesize, MPT3SAS_MAX_PHYS_SEGMENTS); sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
} }
ioc->shost->sg_tablesize = sg_tablesize; ioc->shost->sg_tablesize = sg_tablesize;
......
...@@ -63,15 +63,20 @@ ...@@ -63,15 +63,20 @@
#include <scsi/scsi_transport_sas.h> #include <scsi/scsi_transport_sas.h>
#include <scsi/scsi_dbg.h> #include <scsi/scsi_dbg.h>
#include <scsi/scsi_eh.h> #include <scsi/scsi_eh.h>
#include <linux/pci.h>
#include <linux/poll.h>
#include "mpt3sas_debug.h" #include "mpt3sas_debug.h"
#include "mpt3sas_trigger_diag.h" #include "mpt3sas_trigger_diag.h"
/* driver versioning info */ /* driver versioning info */
#define MPT3SAS_DRIVER_NAME "mpt3sas" #define MPT3SAS_DRIVER_NAME "mpt3sas"
#define MPT2SAS_DRIVER_NAME "mpt2sas"
#define MPT3SAS_AUTHOR "Avago Technologies <MPT-FusionLinux.pdl@avagotech.com>" #define MPT3SAS_AUTHOR "Avago Technologies <MPT-FusionLinux.pdl@avagotech.com>"
#define MPT3SAS_DESCRIPTION "LSI MPT Fusion SAS 3.0 Device Driver" #define MPT3SAS_DESCRIPTION "LSI MPT Fusion SAS 3.0 Device Driver"
#define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
#define MPT3SAS_DRIVER_VERSION "09.100.00.00" #define MPT3SAS_DRIVER_VERSION "09.100.00.00"
#define MPT2SAS_DRIVER_VERSION "20.101.00.00"
#define MPT3SAS_MAJOR_VERSION 9 #define MPT3SAS_MAJOR_VERSION 9
#define MPT3SAS_MINOR_VERSION 100 #define MPT3SAS_MINOR_VERSION 100
#define MPT3SAS_BUILD_VERSION 0 #define MPT3SAS_BUILD_VERSION 0
...@@ -80,14 +85,20 @@ ...@@ -80,14 +85,20 @@
/* /*
* Set MPT3SAS_SG_DEPTH value based on user input. * Set MPT3SAS_SG_DEPTH value based on user input.
*/ */
#define MPT3SAS_MAX_PHYS_SEGMENTS SCSI_MAX_SG_SEGMENTS #define MPT_MAX_PHYS_SEGMENTS SCSI_MAX_SG_SEGMENTS
#define MPT3SAS_MIN_PHYS_SEGMENTS 16 #define MPT_MIN_PHYS_SEGMENTS 16
#ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE #ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE
#define MPT3SAS_SG_DEPTH CONFIG_SCSI_MPT3SAS_MAX_SGE #define MPT3SAS_SG_DEPTH CONFIG_SCSI_MPT3SAS_MAX_SGE
#else #else
#define MPT3SAS_SG_DEPTH MPT3SAS_MAX_PHYS_SEGMENTS #define MPT3SAS_SG_DEPTH MPT_MAX_PHYS_SEGMENTS
#endif #endif
#ifdef CONFIG_SCSI_MPT2SAS_MAX_SGE
#define MPT2SAS_SG_DEPTH CONFIG_SCSI_MPT2SAS_MAX_SGE
#else
#define MPT2SAS_SG_DEPTH MPT_MAX_PHYS_SEGMENTS
#endif
/* /*
* Generic Defines * Generic Defines
...@@ -1095,6 +1106,39 @@ struct _sas_device *mpt3sas_scsih_sas_device_find_by_sas_address( ...@@ -1095,6 +1106,39 @@ struct _sas_device *mpt3sas_scsih_sas_device_find_by_sas_address(
void mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER *ioc); void mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER *ioc);
void scsih_exit(void);
int scsih_init(void);
int scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id);
void scsih_remove(struct pci_dev *pdev);
void scsih_shutdown(struct pci_dev *pdev);
pci_ers_result_t scsih_pci_error_detected(struct pci_dev *pdev,
pci_channel_state_t state);
pci_ers_result_t scsih_pci_mmio_enabled(struct pci_dev *pdev);
pci_ers_result_t scsih_pci_slot_reset(struct pci_dev *pdev);
void scsih_pci_resume(struct pci_dev *pdev);
int scsih_suspend(struct pci_dev *pdev, pm_message_t state);
int scsih_resume(struct pci_dev *pdev);
int scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd);
int scsih_target_alloc(struct scsi_target *starget);
int scsih_slave_alloc(struct scsi_device *sdev);
int scsih_slave_configure(struct scsi_device *sdev);
void scsih_target_destroy(struct scsi_target *starget);
void scsih_slave_destroy(struct scsi_device *sdev);
int scsih_scan_finished(struct Scsi_Host *shost, unsigned long time);
void scsih_scan_start(struct Scsi_Host *shost);
int scsih_change_queue_depth(struct scsi_device *sdev, int qdepth);
int scsih_abort(struct scsi_cmnd *scmd);
int scsih_dev_reset(struct scsi_cmnd *scmd);
int scsih_target_reset(struct scsi_cmnd *scmd);
int scsih_host_reset(struct scsi_cmnd *scmd);
int scsih_bios_param(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int params[]);
int scsih_is_raid(struct device *dev);
void scsih_get_resync(struct device *dev);
void scsih_get_state(struct device *dev);
/* config shared API */ /* config shared API */
u8 mpt3sas_config_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u8 mpt3sas_config_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
u32 reply); u32 reply);
...@@ -1177,8 +1221,12 @@ int mpt3sas_config_get_volume_wwid(struct MPT3SAS_ADAPTER *ioc, ...@@ -1177,8 +1221,12 @@ int mpt3sas_config_get_volume_wwid(struct MPT3SAS_ADAPTER *ioc,
/* ctl shared API */ /* ctl shared API */
extern struct device_attribute *mpt3sas_host_attrs[]; extern struct device_attribute *mpt3sas_host_attrs[];
extern struct device_attribute *mpt3sas_dev_attrs[]; extern struct device_attribute *mpt3sas_dev_attrs[];
void mpt3sas_ctl_init(void); long ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
void mpt3sas_ctl_exit(void); unsigned int ctl_poll(struct file *filep, poll_table *wait);
int ctl_fasync(int fd, struct file *filep, int mode);
long ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg);
void ctl_init(void);
void ctl_exit(void);
u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
u32 reply); u32 reply);
void mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase); void mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase);
......
...@@ -490,27 +490,27 @@ mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase) ...@@ -490,27 +490,27 @@ mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase)
} }
/** /**
* _ctl_fasync - * ctl_fasync -
* @fd - * @fd -
* @filep - * @filep -
* @mode - * @mode -
* *
* Called when application request fasyn callback handler. * Called when application request fasyn callback handler.
*/ */
static int int
_ctl_fasync(int fd, struct file *filep, int mode) ctl_fasync(int fd, struct file *filep, int mode)
{ {
return fasync_helper(fd, filep, mode, &async_queue); return fasync_helper(fd, filep, mode, &async_queue);
} }
/** /**
* _ctl_poll - * ctl_poll -
* @file - * @file -
* @wait - * @wait -
* *
*/ */
static unsigned int unsigned int
_ctl_poll(struct file *filep, poll_table *wait) ctl_poll(struct file *filep, poll_table *wait)
{ {
struct MPT3SAS_ADAPTER *ioc; struct MPT3SAS_ADAPTER *ioc;
...@@ -2298,13 +2298,13 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg, ...@@ -2298,13 +2298,13 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg,
} }
/** /**
* _ctl_ioctl - main ioctl entry point (unlocked) * ctl_ioctl - main ioctl entry point (unlocked)
* @file - (struct file) * @file - (struct file)
* @cmd - ioctl opcode * @cmd - ioctl opcode
* @arg - * @arg -
*/ */
static long long
_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
long ret; long ret;
...@@ -2314,15 +2314,15 @@ _ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -2314,15 +2314,15 @@ _ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
/** /**
* _ctl_ioctl_compat - main ioctl entry point (compat) * ctl_ioctl_compat - main ioctl entry point (compat)
* @file - * @file -
* @cmd - * @cmd -
* @arg - * @arg -
* *
* This routine handles 32 bit applications in 64bit os. * This routine handles 32 bit applications in 64bit os.
*/ */
static long long
_ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg) ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg)
{ {
long ret; long ret;
...@@ -3220,11 +3220,11 @@ struct device_attribute *mpt3sas_dev_attrs[] = { ...@@ -3220,11 +3220,11 @@ struct device_attribute *mpt3sas_dev_attrs[] = {
static const struct file_operations ctl_fops = { static const struct file_operations ctl_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.unlocked_ioctl = _ctl_ioctl, .unlocked_ioctl = ctl_ioctl,
.poll = _ctl_poll, .poll = ctl_poll,
.fasync = _ctl_fasync, .fasync = ctl_fasync,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = _ctl_ioctl_compat, .compat_ioctl = ctl_ioctl_compat,
#endif #endif
}; };
...@@ -3235,11 +3235,11 @@ static struct miscdevice ctl_dev = { ...@@ -3235,11 +3235,11 @@ static struct miscdevice ctl_dev = {
}; };
/** /**
* mpt3sas_ctl_init - main entry point for ctl. * ctl_init - main entry point for ctl.
* *
*/ */
void void
mpt3sas_ctl_init(void) ctl_init(void)
{ {
async_queue = NULL; async_queue = NULL;
if (misc_register(&ctl_dev) < 0) if (misc_register(&ctl_dev) < 0)
...@@ -3250,11 +3250,11 @@ mpt3sas_ctl_init(void) ...@@ -3250,11 +3250,11 @@ mpt3sas_ctl_init(void)
} }
/** /**
* mpt3sas_ctl_exit - exit point for ctl * ctl_exit - exit point for ctl
* *
*/ */
void void
mpt3sas_ctl_exit(void) ctl_exit(void)
{ {
struct MPT3SAS_ADAPTER *ioc; struct MPT3SAS_ADAPTER *ioc;
int i; int i;
......
This diff is collapsed.
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