aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ips.c
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2007-05-23 17:41:46 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-05-24 10:14:41 -0400
commitc6a6c81cfdd0f9b95bf215d1b5626f4dbf1aba7d (patch)
treeca411cf781a367bd2f09ff3b32bc971ba514be9f /drivers/scsi/ips.c
parent6a31a8a651c1d671afc2438cbecb3ee3d610fac8 (diff)
[SCSI] ips: remove kernel 2.4 code
Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: "Salyzyn, Mark" <mark_salyzyn@adaptec.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/ips.c')
-rw-r--r--drivers/scsi/ips.c145
1 files changed, 18 insertions, 127 deletions
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 8b704f73055a..84f4f5d06f9d 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -211,19 +211,6 @@ module_param(ips, charp, 0);
211#warning "This driver has only been tested on the x86/ia64/x86_64 platforms" 211#warning "This driver has only been tested on the x86/ia64/x86_64 platforms"
212#endif 212#endif
213 213
214#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
215#include <linux/blk.h>
216#include "sd.h"
217#define IPS_LOCK_SAVE(lock,flags) spin_lock_irqsave(&io_request_lock,flags)
218#define IPS_UNLOCK_RESTORE(lock,flags) spin_unlock_irqrestore(&io_request_lock,flags)
219#ifndef __devexit_p
220#define __devexit_p(x) x
221#endif
222#else
223#define IPS_LOCK_SAVE(lock,flags) do{spin_lock(lock);(void)flags;}while(0)
224#define IPS_UNLOCK_RESTORE(lock,flags) do{spin_unlock(lock);(void)flags;}while(0)
225#endif
226
227#define IPS_DMA_DIR(scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \ 214#define IPS_DMA_DIR(scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \
228 DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \ 215 DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \
229 PCI_DMA_BIDIRECTIONAL : \ 216 PCI_DMA_BIDIRECTIONAL : \
@@ -381,24 +368,13 @@ static struct scsi_host_template ips_driver_template = {
381 .eh_abort_handler = ips_eh_abort, 368 .eh_abort_handler = ips_eh_abort,
382 .eh_host_reset_handler = ips_eh_reset, 369 .eh_host_reset_handler = ips_eh_reset,
383 .proc_name = "ips", 370 .proc_name = "ips",
384#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
385 .proc_info = ips_proc_info, 371 .proc_info = ips_proc_info,
386 .slave_configure = ips_slave_configure, 372 .slave_configure = ips_slave_configure,
387#else
388 .proc_info = ips_proc24_info,
389 .select_queue_depths = ips_select_queue_depth,
390#endif
391 .bios_param = ips_biosparam, 373 .bios_param = ips_biosparam,
392 .this_id = -1, 374 .this_id = -1,
393 .sg_tablesize = IPS_MAX_SG, 375 .sg_tablesize = IPS_MAX_SG,
394 .cmd_per_lun = 3, 376 .cmd_per_lun = 3,
395 .use_clustering = ENABLE_CLUSTERING, 377 .use_clustering = ENABLE_CLUSTERING,
396#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
397 .use_new_eh_code = 1,
398#endif
399#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) && LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
400 .highmem_io = 1,
401#endif
402}; 378};
403 379
404 380
@@ -731,7 +707,7 @@ ips_release(struct Scsi_Host *sh)
731 /* free IRQ */ 707 /* free IRQ */
732 free_irq(ha->irq, ha); 708 free_irq(ha->irq, ha);
733 709
734 IPS_REMOVE_HOST(sh); 710 scsi_remove_host(sh);
735 scsi_host_put(sh); 711 scsi_host_put(sh);
736 712
737 ips_released_controllers++; 713 ips_released_controllers++;
@@ -813,7 +789,6 @@ int ips_eh_abort(struct scsi_cmnd *SC)
813 ips_ha_t *ha; 789 ips_ha_t *ha;
814 ips_copp_wait_item_t *item; 790 ips_copp_wait_item_t *item;
815 int ret; 791 int ret;
816 unsigned long cpu_flags;
817 struct Scsi_Host *host; 792 struct Scsi_Host *host;
818 793
819 METHOD_TRACE("ips_eh_abort", 1); 794 METHOD_TRACE("ips_eh_abort", 1);
@@ -830,7 +805,7 @@ int ips_eh_abort(struct scsi_cmnd *SC)
830 if (!ha->active) 805 if (!ha->active)
831 return (FAILED); 806 return (FAILED);
832 807
833 IPS_LOCK_SAVE(host->host_lock, cpu_flags); 808 spin_lock(host->host_lock);
834 809
835 /* See if the command is on the copp queue */ 810 /* See if the command is on the copp queue */
836 item = ha->copp_waitlist.head; 811 item = ha->copp_waitlist.head;
@@ -851,7 +826,7 @@ int ips_eh_abort(struct scsi_cmnd *SC)
851 ret = (FAILED); 826 ret = (FAILED);
852 } 827 }
853 828
854 IPS_UNLOCK_RESTORE(host->host_lock, cpu_flags); 829 spin_unlock(host->host_lock);
855 return ret; 830 return ret;
856} 831}
857 832
@@ -1176,18 +1151,10 @@ static int ips_queue(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *))
1176/* Set bios geometry for the controller */ 1151/* Set bios geometry for the controller */
1177/* */ 1152/* */
1178/****************************************************************************/ 1153/****************************************************************************/
1179static int 1154static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
1180#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) 1155 sector_t capacity, int geom[])
1181ips_biosparam(Disk * disk, kdev_t dev, int geom[])
1182{
1183 ips_ha_t *ha = (ips_ha_t *) disk->device->host->hostdata;
1184 unsigned long capacity = disk->capacity;
1185#else
1186ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
1187 sector_t capacity, int geom[])
1188{ 1156{
1189 ips_ha_t *ha = (ips_ha_t *) sdev->host->hostdata; 1157 ips_ha_t *ha = (ips_ha_t *) sdev->host->hostdata;
1190#endif
1191 int heads; 1158 int heads;
1192 int sectors; 1159 int sectors;
1193 int cylinders; 1160 int cylinders;
@@ -1225,70 +1192,6 @@ ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
1225 return (0); 1192 return (0);
1226} 1193}
1227 1194
1228#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
1229
1230/* ips_proc24_info is a wrapper around ips_proc_info *
1231 * for compatibility with the 2.4 scsi parameters */
1232static int
1233ips_proc24_info(char *buffer, char **start, off_t offset, int length,
1234 int hostno, int func)
1235{
1236 int i;
1237
1238 for (i = 0; i < ips_next_controller; i++) {
1239 if (ips_sh[i] && ips_sh[i]->host_no == hostno) {
1240 return ips_proc_info(ips_sh[i], buffer, start,
1241 offset, length, func);
1242 }
1243 }
1244 return -EINVAL;
1245}
1246
1247/****************************************************************************/
1248/* */
1249/* Routine Name: ips_select_queue_depth */
1250/* */
1251/* Routine Description: */
1252/* */
1253/* Select queue depths for the devices on the contoller */
1254/* */
1255/****************************************************************************/
1256static void
1257ips_select_queue_depth(struct Scsi_Host *host, struct scsi_device * scsi_devs)
1258{
1259 struct scsi_device *device;
1260 ips_ha_t *ha;
1261 int count = 0;
1262 int min;
1263
1264 ha = IPS_HA(host);
1265 min = ha->max_cmds / 4;
1266
1267 for (device = scsi_devs; device; device = device->next) {
1268 if (device->host == host) {
1269 if ((device->channel == 0) && (device->type == 0))
1270 count++;
1271 }
1272 }
1273
1274 for (device = scsi_devs; device; device = device->next) {
1275 if (device->host == host) {
1276 if ((device->channel == 0) && (device->type == 0)) {
1277 device->queue_depth =
1278 (ha->max_cmds - 1) / count;
1279 if (device->queue_depth < min)
1280 device->queue_depth = min;
1281 } else {
1282 device->queue_depth = 2;
1283 }
1284
1285 if (device->queue_depth < 2)
1286 device->queue_depth = 2;
1287 }
1288 }
1289}
1290
1291#else
1292/****************************************************************************/ 1195/****************************************************************************/
1293/* */ 1196/* */
1294/* Routine Name: ips_slave_configure */ 1197/* Routine Name: ips_slave_configure */
@@ -1316,7 +1219,6 @@ ips_slave_configure(struct scsi_device * SDptr)
1316 SDptr->skip_ms_page_3f = 1; 1219 SDptr->skip_ms_page_3f = 1;
1317 return 0; 1220 return 0;
1318} 1221}
1319#endif
1320 1222
1321/****************************************************************************/ 1223/****************************************************************************/
1322/* */ 1224/* */
@@ -1331,7 +1233,6 @@ static irqreturn_t
1331do_ipsintr(int irq, void *dev_id) 1233do_ipsintr(int irq, void *dev_id)
1332{ 1234{
1333 ips_ha_t *ha; 1235 ips_ha_t *ha;
1334 unsigned long cpu_flags;
1335 struct Scsi_Host *host; 1236 struct Scsi_Host *host;
1336 int irqstatus; 1237 int irqstatus;
1337 1238
@@ -1347,16 +1248,16 @@ do_ipsintr(int irq, void *dev_id)
1347 return IRQ_HANDLED; 1248 return IRQ_HANDLED;
1348 } 1249 }
1349 1250
1350 IPS_LOCK_SAVE(host->host_lock, cpu_flags); 1251 spin_lock(host->host_lock);
1351 1252
1352 if (!ha->active) { 1253 if (!ha->active) {
1353 IPS_UNLOCK_RESTORE(host->host_lock, cpu_flags); 1254 spin_unlock(host->host_lock);
1354 return IRQ_HANDLED; 1255 return IRQ_HANDLED;
1355 } 1256 }
1356 1257
1357 irqstatus = (*ha->func.intr) (ha); 1258 irqstatus = (*ha->func.intr) (ha);
1358 1259
1359 IPS_UNLOCK_RESTORE(host->host_lock, cpu_flags); 1260 spin_unlock(host->host_lock);
1360 1261
1361 /* start the next command */ 1262 /* start the next command */
1362 ips_next(ha, IPS_INTR_ON); 1263 ips_next(ha, IPS_INTR_ON);
@@ -2730,7 +2631,6 @@ ips_next(ips_ha_t * ha, int intr)
2730 struct scsi_cmnd *q; 2631 struct scsi_cmnd *q;
2731 ips_copp_wait_item_t *item; 2632 ips_copp_wait_item_t *item;
2732 int ret; 2633 int ret;
2733 unsigned long cpu_flags = 0;
2734 struct Scsi_Host *host; 2634 struct Scsi_Host *host;
2735 METHOD_TRACE("ips_next", 1); 2635 METHOD_TRACE("ips_next", 1);
2736 2636
@@ -2742,7 +2642,7 @@ ips_next(ips_ha_t * ha, int intr)
2742 * this command won't time out 2642 * this command won't time out
2743 */ 2643 */
2744 if (intr == IPS_INTR_ON) 2644 if (intr == IPS_INTR_ON)
2745 IPS_LOCK_SAVE(host->host_lock, cpu_flags); 2645 spin_lock(host->host_lock);
2746 2646
2747 if ((ha->subsys->param[3] & 0x300000) 2647 if ((ha->subsys->param[3] & 0x300000)
2748 && (ha->scb_activelist.count == 0)) { 2648 && (ha->scb_activelist.count == 0)) {
@@ -2769,14 +2669,14 @@ ips_next(ips_ha_t * ha, int intr)
2769 item = ips_removeq_copp_head(&ha->copp_waitlist); 2669 item = ips_removeq_copp_head(&ha->copp_waitlist);
2770 ha->num_ioctl++; 2670 ha->num_ioctl++;
2771 if (intr == IPS_INTR_ON) 2671 if (intr == IPS_INTR_ON)
2772 IPS_UNLOCK_RESTORE(host->host_lock, cpu_flags); 2672 spin_unlock(host->host_lock);
2773 scb->scsi_cmd = item->scsi_cmd; 2673 scb->scsi_cmd = item->scsi_cmd;
2774 kfree(item); 2674 kfree(item);
2775 2675
2776 ret = ips_make_passthru(ha, scb->scsi_cmd, scb, intr); 2676 ret = ips_make_passthru(ha, scb->scsi_cmd, scb, intr);
2777 2677
2778 if (intr == IPS_INTR_ON) 2678 if (intr == IPS_INTR_ON)
2779 IPS_LOCK_SAVE(host->host_lock, cpu_flags); 2679 spin_lock(host->host_lock);
2780 switch (ret) { 2680 switch (ret) {
2781 case IPS_FAILURE: 2681 case IPS_FAILURE:
2782 if (scb->scsi_cmd) { 2682 if (scb->scsi_cmd) {
@@ -2846,7 +2746,7 @@ ips_next(ips_ha_t * ha, int intr)
2846 SC = ips_removeq_wait(&ha->scb_waitlist, q); 2746 SC = ips_removeq_wait(&ha->scb_waitlist, q);
2847 2747
2848 if (intr == IPS_INTR_ON) 2748 if (intr == IPS_INTR_ON)
2849 IPS_UNLOCK_RESTORE(host->host_lock, cpu_flags); /* Unlock HA after command is taken off queue */ 2749 spin_unlock(host->host_lock); /* Unlock HA after command is taken off queue */
2850 2750
2851 SC->result = DID_OK; 2751 SC->result = DID_OK;
2852 SC->host_scribble = NULL; 2752 SC->host_scribble = NULL;
@@ -2919,7 +2819,7 @@ ips_next(ips_ha_t * ha, int intr)
2919 scb->dcdb.transfer_length = 0; 2819 scb->dcdb.transfer_length = 0;
2920 } 2820 }
2921 if (intr == IPS_INTR_ON) 2821 if (intr == IPS_INTR_ON)
2922 IPS_LOCK_SAVE(host->host_lock, cpu_flags); 2822 spin_lock(host->host_lock);
2923 2823
2924 ret = ips_send_cmd(ha, scb); 2824 ret = ips_send_cmd(ha, scb);
2925 2825
@@ -2958,7 +2858,7 @@ ips_next(ips_ha_t * ha, int intr)
2958 } /* end while */ 2858 } /* end while */
2959 2859
2960 if (intr == IPS_INTR_ON) 2860 if (intr == IPS_INTR_ON)
2961 IPS_UNLOCK_RESTORE(host->host_lock, cpu_flags); 2861 spin_unlock(host->host_lock);
2962} 2862}
2963 2863
2964/****************************************************************************/ 2864/****************************************************************************/
@@ -7004,7 +6904,6 @@ ips_register_scsi(int index)
7004 kfree(oldha); 6904 kfree(oldha);
7005 ips_sh[index] = sh; 6905 ips_sh[index] = sh;
7006 ips_ha[index] = ha; 6906 ips_ha[index] = ha;
7007 IPS_SCSI_SET_DEVICE(sh, ha);
7008 6907
7009 /* Store away needed values for later use */ 6908 /* Store away needed values for later use */
7010 sh->io_port = ha->io_addr; 6909 sh->io_port = ha->io_addr;
@@ -7016,17 +6915,16 @@ ips_register_scsi(int index)
7016 sh->cmd_per_lun = sh->hostt->cmd_per_lun; 6915 sh->cmd_per_lun = sh->hostt->cmd_per_lun;
7017 sh->unchecked_isa_dma = sh->hostt->unchecked_isa_dma; 6916 sh->unchecked_isa_dma = sh->hostt->unchecked_isa_dma;
7018 sh->use_clustering = sh->hostt->use_clustering; 6917 sh->use_clustering = sh->hostt->use_clustering;
7019
7020#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
7021 sh->max_sectors = 128; 6918 sh->max_sectors = 128;
7022#endif
7023 6919
7024 sh->max_id = ha->ntargets; 6920 sh->max_id = ha->ntargets;
7025 sh->max_lun = ha->nlun; 6921 sh->max_lun = ha->nlun;
7026 sh->max_channel = ha->nbus - 1; 6922 sh->max_channel = ha->nbus - 1;
7027 sh->can_queue = ha->max_cmds - 1; 6923 sh->can_queue = ha->max_cmds - 1;
7028 6924
7029 IPS_ADD_HOST(sh, NULL); 6925 scsi_add_host(sh, NULL);
6926 scsi_scan_host(sh);
6927
7030 return 0; 6928 return 0;
7031} 6929}
7032 6930
@@ -7069,7 +6967,7 @@ ips_module_init(void)
7069 return -ENODEV; 6967 return -ENODEV;
7070 ips_driver_template.module = THIS_MODULE; 6968 ips_driver_template.module = THIS_MODULE;
7071 ips_order_controllers(); 6969 ips_order_controllers();
7072 if (IPS_REGISTER_HOSTS(&ips_driver_template)) { 6970 if (!ips_detect(&ips_driver_template)) {
7073 pci_unregister_driver(&ips_pci_driver); 6971 pci_unregister_driver(&ips_pci_driver);
7074 return -ENODEV; 6972 return -ENODEV;
7075 } 6973 }
@@ -7087,7 +6985,6 @@ ips_module_init(void)
7087static void __exit 6985static void __exit
7088ips_module_exit(void) 6986ips_module_exit(void)
7089{ 6987{
7090 IPS_UNREGISTER_HOSTS(&ips_driver_template);
7091 pci_unregister_driver(&ips_pci_driver); 6988 pci_unregister_driver(&ips_pci_driver);
7092 unregister_reboot_notifier(&ips_notifier); 6989 unregister_reboot_notifier(&ips_notifier);
7093} 6990}
@@ -7443,15 +7340,9 @@ ips_init_phase2(int index)
7443 return SUCCESS; 7340 return SUCCESS;
7444} 7341}
7445 7342
7446#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,9)
7447MODULE_LICENSE("GPL"); 7343MODULE_LICENSE("GPL");
7448#endif
7449
7450MODULE_DESCRIPTION("IBM ServeRAID Adapter Driver " IPS_VER_STRING); 7344MODULE_DESCRIPTION("IBM ServeRAID Adapter Driver " IPS_VER_STRING);
7451
7452#ifdef MODULE_VERSION
7453MODULE_VERSION(IPS_VER_STRING); 7345MODULE_VERSION(IPS_VER_STRING);
7454#endif
7455 7346
7456 7347
7457/* 7348/*