Skip to content

Commit 8a7e4c2

Browse files
Sreekanth Reddymartinkpetersen
authored andcommitted
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: Sreekanth Reddy <[email protected]> Acked-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 3c58665 commit 8a7e4c2

File tree

4 files changed

+191
-145
lines changed

4 files changed

+191
-145
lines changed

drivers/scsi/mpt3sas/mpt3sas_base.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,15 +2855,15 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
28552855
else
28562856
sg_tablesize = MPT3SAS_SG_DEPTH;
28572857

2858-
if (sg_tablesize < MPT3SAS_MIN_PHYS_SEGMENTS)
2859-
sg_tablesize = MPT3SAS_MIN_PHYS_SEGMENTS;
2860-
else if (sg_tablesize > MPT3SAS_MAX_PHYS_SEGMENTS) {
2858+
if (sg_tablesize < MPT_MIN_PHYS_SEGMENTS)
2859+
sg_tablesize = MPT_MIN_PHYS_SEGMENTS;
2860+
else if (sg_tablesize > MPT_MAX_PHYS_SEGMENTS) {
28612861
sg_tablesize = min_t(unsigned short, sg_tablesize,
28622862
SCSI_MAX_SG_CHAIN_SEGMENTS);
28632863
pr_warn(MPT3SAS_FMT
28642864
"sg_tablesize(%u) is bigger than kernel"
28652865
" defined SCSI_MAX_SG_SEGMENTS(%u)\n", ioc->name,
2866-
sg_tablesize, MPT3SAS_MAX_PHYS_SEGMENTS);
2866+
sg_tablesize, MPT_MAX_PHYS_SEGMENTS);
28672867
}
28682868
ioc->shost->sg_tablesize = sg_tablesize;
28692869

drivers/scsi/mpt3sas/mpt3sas_base.h

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,20 @@
6363
#include <scsi/scsi_transport_sas.h>
6464
#include <scsi/scsi_dbg.h>
6565
#include <scsi/scsi_eh.h>
66+
#include <linux/pci.h>
67+
#include <linux/poll.h>
6668

6769
#include "mpt3sas_debug.h"
6870
#include "mpt3sas_trigger_diag.h"
6971

7072
/* driver versioning info */
7173
#define MPT3SAS_DRIVER_NAME "mpt3sas"
74+
#define MPT2SAS_DRIVER_NAME "mpt2sas"
7275
#define MPT3SAS_AUTHOR "Avago Technologies <[email protected]>"
7376
#define MPT3SAS_DESCRIPTION "LSI MPT Fusion SAS 3.0 Device Driver"
77+
#define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
7478
#define MPT3SAS_DRIVER_VERSION "09.100.00.00"
79+
#define MPT2SAS_DRIVER_VERSION "20.101.00.00"
7580
#define MPT3SAS_MAJOR_VERSION 9
7681
#define MPT3SAS_MINOR_VERSION 100
7782
#define MPT3SAS_BUILD_VERSION 0
@@ -80,14 +85,20 @@
8085
/*
8186
* Set MPT3SAS_SG_DEPTH value based on user input.
8287
*/
83-
#define MPT3SAS_MAX_PHYS_SEGMENTS SCSI_MAX_SG_SEGMENTS
84-
#define MPT3SAS_MIN_PHYS_SEGMENTS 16
88+
#define MPT_MAX_PHYS_SEGMENTS SCSI_MAX_SG_SEGMENTS
89+
#define MPT_MIN_PHYS_SEGMENTS 16
90+
8591
#ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE
8692
#define MPT3SAS_SG_DEPTH CONFIG_SCSI_MPT3SAS_MAX_SGE
8793
#else
88-
#define MPT3SAS_SG_DEPTH MPT3SAS_MAX_PHYS_SEGMENTS
94+
#define MPT3SAS_SG_DEPTH MPT_MAX_PHYS_SEGMENTS
8995
#endif
9096

97+
#ifdef CONFIG_SCSI_MPT2SAS_MAX_SGE
98+
#define MPT2SAS_SG_DEPTH CONFIG_SCSI_MPT2SAS_MAX_SGE
99+
#else
100+
#define MPT2SAS_SG_DEPTH MPT_MAX_PHYS_SEGMENTS
101+
#endif
91102

92103
/*
93104
* Generic Defines
@@ -1095,6 +1106,39 @@ struct _sas_device *mpt3sas_scsih_sas_device_find_by_sas_address(
10951106

10961107
void mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER *ioc);
10971108

1109+
void scsih_exit(void);
1110+
int scsih_init(void);
1111+
int scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id);
1112+
void scsih_remove(struct pci_dev *pdev);
1113+
void scsih_shutdown(struct pci_dev *pdev);
1114+
pci_ers_result_t scsih_pci_error_detected(struct pci_dev *pdev,
1115+
pci_channel_state_t state);
1116+
pci_ers_result_t scsih_pci_mmio_enabled(struct pci_dev *pdev);
1117+
pci_ers_result_t scsih_pci_slot_reset(struct pci_dev *pdev);
1118+
void scsih_pci_resume(struct pci_dev *pdev);
1119+
int scsih_suspend(struct pci_dev *pdev, pm_message_t state);
1120+
int scsih_resume(struct pci_dev *pdev);
1121+
1122+
int scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd);
1123+
int scsih_target_alloc(struct scsi_target *starget);
1124+
int scsih_slave_alloc(struct scsi_device *sdev);
1125+
int scsih_slave_configure(struct scsi_device *sdev);
1126+
void scsih_target_destroy(struct scsi_target *starget);
1127+
void scsih_slave_destroy(struct scsi_device *sdev);
1128+
int scsih_scan_finished(struct Scsi_Host *shost, unsigned long time);
1129+
void scsih_scan_start(struct Scsi_Host *shost);
1130+
int scsih_change_queue_depth(struct scsi_device *sdev, int qdepth);
1131+
int scsih_abort(struct scsi_cmnd *scmd);
1132+
int scsih_dev_reset(struct scsi_cmnd *scmd);
1133+
int scsih_target_reset(struct scsi_cmnd *scmd);
1134+
int scsih_host_reset(struct scsi_cmnd *scmd);
1135+
int scsih_bios_param(struct scsi_device *sdev, struct block_device *bdev,
1136+
sector_t capacity, int params[]);
1137+
1138+
int scsih_is_raid(struct device *dev);
1139+
void scsih_get_resync(struct device *dev);
1140+
void scsih_get_state(struct device *dev);
1141+
10981142
/* config shared API */
10991143
u8 mpt3sas_config_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
11001144
u32 reply);
@@ -1177,8 +1221,12 @@ int mpt3sas_config_get_volume_wwid(struct MPT3SAS_ADAPTER *ioc,
11771221
/* ctl shared API */
11781222
extern struct device_attribute *mpt3sas_host_attrs[];
11791223
extern struct device_attribute *mpt3sas_dev_attrs[];
1180-
void mpt3sas_ctl_init(void);
1181-
void mpt3sas_ctl_exit(void);
1224+
long ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
1225+
unsigned int ctl_poll(struct file *filep, poll_table *wait);
1226+
int ctl_fasync(int fd, struct file *filep, int mode);
1227+
long ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg);
1228+
void ctl_init(void);
1229+
void ctl_exit(void);
11821230
u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
11831231
u32 reply);
11841232
void mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase);

drivers/scsi/mpt3sas/mpt3sas_ctl.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -490,27 +490,27 @@ mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase)
490490
}
491491

492492
/**
493-
* _ctl_fasync -
493+
* ctl_fasync -
494494
* @fd -
495495
* @filep -
496496
* @mode -
497497
*
498498
* Called when application request fasyn callback handler.
499499
*/
500-
static int
501-
_ctl_fasync(int fd, struct file *filep, int mode)
500+
int
501+
ctl_fasync(int fd, struct file *filep, int mode)
502502
{
503503
return fasync_helper(fd, filep, mode, &async_queue);
504504
}
505505

506506
/**
507-
* _ctl_poll -
507+
* ctl_poll -
508508
* @file -
509509
* @wait -
510510
*
511511
*/
512-
static unsigned int
513-
_ctl_poll(struct file *filep, poll_table *wait)
512+
unsigned int
513+
ctl_poll(struct file *filep, poll_table *wait)
514514
{
515515
struct MPT3SAS_ADAPTER *ioc;
516516

@@ -2298,13 +2298,13 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg,
22982298
}
22992299

23002300
/**
2301-
* _ctl_ioctl - main ioctl entry point (unlocked)
2301+
* ctl_ioctl - main ioctl entry point (unlocked)
23022302
* @file - (struct file)
23032303
* @cmd - ioctl opcode
23042304
* @arg -
23052305
*/
2306-
static long
2307-
_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2306+
long
2307+
ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
23082308
{
23092309
long ret;
23102310

@@ -2314,15 +2314,15 @@ _ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
23142314

23152315
#ifdef CONFIG_COMPAT
23162316
/**
2317-
* _ctl_ioctl_compat - main ioctl entry point (compat)
2317+
* ctl_ioctl_compat - main ioctl entry point (compat)
23182318
* @file -
23192319
* @cmd -
23202320
* @arg -
23212321
*
23222322
* This routine handles 32 bit applications in 64bit os.
23232323
*/
2324-
static long
2325-
_ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg)
2324+
long
2325+
ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg)
23262326
{
23272327
long ret;
23282328

@@ -3220,11 +3220,11 @@ struct device_attribute *mpt3sas_dev_attrs[] = {
32203220

32213221
static const struct file_operations ctl_fops = {
32223222
.owner = THIS_MODULE,
3223-
.unlocked_ioctl = _ctl_ioctl,
3224-
.poll = _ctl_poll,
3225-
.fasync = _ctl_fasync,
3223+
.unlocked_ioctl = ctl_ioctl,
3224+
.poll = ctl_poll,
3225+
.fasync = ctl_fasync,
32263226
#ifdef CONFIG_COMPAT
3227-
.compat_ioctl = _ctl_ioctl_compat,
3227+
.compat_ioctl = ctl_ioctl_compat,
32283228
#endif
32293229
};
32303230

@@ -3235,11 +3235,11 @@ static struct miscdevice ctl_dev = {
32353235
};
32363236

32373237
/**
3238-
* mpt3sas_ctl_init - main entry point for ctl.
3238+
* ctl_init - main entry point for ctl.
32393239
*
32403240
*/
32413241
void
3242-
mpt3sas_ctl_init(void)
3242+
ctl_init(void)
32433243
{
32443244
async_queue = NULL;
32453245
if (misc_register(&ctl_dev) < 0)
@@ -3250,11 +3250,11 @@ mpt3sas_ctl_init(void)
32503250
}
32513251

32523252
/**
3253-
* mpt3sas_ctl_exit - exit point for ctl
3253+
* ctl_exit - exit point for ctl
32543254
*
32553255
*/
32563256
void
3257-
mpt3sas_ctl_exit(void)
3257+
ctl_exit(void)
32583258
{
32593259
struct MPT3SAS_ADAPTER *ioc;
32603260
int i;

0 commit comments

Comments
 (0)