aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ips.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ips.c')
-rw-r--r--drivers/scsi/ips.c91
1 files changed, 39 insertions, 52 deletions
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 3c639286ec1e..9a9ab297cf17 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -182,14 +182,8 @@
182#include <linux/dma-mapping.h> 182#include <linux/dma-mapping.h>
183 183
184#include <scsi/sg.h> 184#include <scsi/sg.h>
185
186#include "scsi.h" 185#include "scsi.h"
187
188#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
189#include "hosts.h"
190#else
191#include <scsi/scsi_host.h> 186#include <scsi/scsi_host.h>
192#endif
193 187
194#include "ips.h" 188#include "ips.h"
195 189
@@ -250,9 +244,9 @@ module_param(ips, charp, 0);
250 */ 244 */
251static int ips_detect(struct scsi_host_template *); 245static int ips_detect(struct scsi_host_template *);
252static int ips_release(struct Scsi_Host *); 246static int ips_release(struct Scsi_Host *);
253static int ips_eh_abort(Scsi_Cmnd *); 247static int ips_eh_abort(struct scsi_cmnd *);
254static int ips_eh_reset(Scsi_Cmnd *); 248static int ips_eh_reset(struct scsi_cmnd *);
255static int ips_queue(Scsi_Cmnd *, void (*)(Scsi_Cmnd *)); 249static int ips_queue(struct scsi_cmnd *, void (*)(struct scsi_cmnd *));
256static const char *ips_info(struct Scsi_Host *); 250static const char *ips_info(struct Scsi_Host *);
257static irqreturn_t do_ipsintr(int, void *, struct pt_regs *); 251static irqreturn_t do_ipsintr(int, void *, struct pt_regs *);
258static int ips_hainit(ips_ha_t *); 252static int ips_hainit(ips_ha_t *);
@@ -325,24 +319,26 @@ static uint32_t ips_statupd_copperhead_memio(ips_ha_t *);
325static uint32_t ips_statupd_morpheus(ips_ha_t *); 319static uint32_t ips_statupd_morpheus(ips_ha_t *);
326static ips_scb_t *ips_getscb(ips_ha_t *); 320static ips_scb_t *ips_getscb(ips_ha_t *);
327static void ips_putq_scb_head(ips_scb_queue_t *, ips_scb_t *); 321static void ips_putq_scb_head(ips_scb_queue_t *, ips_scb_t *);
328static void ips_putq_wait_tail(ips_wait_queue_t *, Scsi_Cmnd *); 322static void ips_putq_wait_tail(ips_wait_queue_t *, struct scsi_cmnd *);
329static void ips_putq_copp_tail(ips_copp_queue_t *, 323static void ips_putq_copp_tail(ips_copp_queue_t *,
330 ips_copp_wait_item_t *); 324 ips_copp_wait_item_t *);
331static ips_scb_t *ips_removeq_scb_head(ips_scb_queue_t *); 325static ips_scb_t *ips_removeq_scb_head(ips_scb_queue_t *);
332static ips_scb_t *ips_removeq_scb(ips_scb_queue_t *, ips_scb_t *); 326static ips_scb_t *ips_removeq_scb(ips_scb_queue_t *, ips_scb_t *);
333static Scsi_Cmnd *ips_removeq_wait_head(ips_wait_queue_t *); 327static struct scsi_cmnd *ips_removeq_wait_head(ips_wait_queue_t *);
334static Scsi_Cmnd *ips_removeq_wait(ips_wait_queue_t *, Scsi_Cmnd *); 328static struct scsi_cmnd *ips_removeq_wait(ips_wait_queue_t *,
329 struct scsi_cmnd *);
335static ips_copp_wait_item_t *ips_removeq_copp(ips_copp_queue_t *, 330static ips_copp_wait_item_t *ips_removeq_copp(ips_copp_queue_t *,
336 ips_copp_wait_item_t *); 331 ips_copp_wait_item_t *);
337static ips_copp_wait_item_t *ips_removeq_copp_head(ips_copp_queue_t *); 332static ips_copp_wait_item_t *ips_removeq_copp_head(ips_copp_queue_t *);
338 333
339static int ips_is_passthru(Scsi_Cmnd *); 334static int ips_is_passthru(struct scsi_cmnd *);
340static int ips_make_passthru(ips_ha_t *, Scsi_Cmnd *, ips_scb_t *, int); 335static int ips_make_passthru(ips_ha_t *, struct scsi_cmnd *, ips_scb_t *, int);
341static int ips_usrcmd(ips_ha_t *, ips_passthru_t *, ips_scb_t *); 336static int ips_usrcmd(ips_ha_t *, ips_passthru_t *, ips_scb_t *);
342static void ips_cleanup_passthru(ips_ha_t *, ips_scb_t *); 337static void ips_cleanup_passthru(ips_ha_t *, ips_scb_t *);
343static void ips_scmd_buf_write(Scsi_Cmnd * scmd, void *data, 338static void ips_scmd_buf_write(struct scsi_cmnd * scmd, void *data,
344 unsigned int count); 339 unsigned int count);
345static void ips_scmd_buf_read(Scsi_Cmnd * scmd, void *data, unsigned int count); 340static void ips_scmd_buf_read(struct scsi_cmnd * scmd, void *data,
341 unsigned int count);
346 342
347static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); 343static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
348static int ips_host_info(ips_ha_t *, char *, off_t, int); 344static int ips_host_info(ips_ha_t *, char *, off_t, int);
@@ -812,8 +808,7 @@ ips_halt(struct notifier_block *nb, ulong event, void *buf)
812/* Abort a command (using the new error code stuff) */ 808/* Abort a command (using the new error code stuff) */
813/* Note: this routine is called under the io_request_lock */ 809/* Note: this routine is called under the io_request_lock */
814/****************************************************************************/ 810/****************************************************************************/
815int 811int ips_eh_abort(struct scsi_cmnd *SC)
816ips_eh_abort(Scsi_Cmnd * SC)
817{ 812{
818 ips_ha_t *ha; 813 ips_ha_t *ha;
819 ips_copp_wait_item_t *item; 814 ips_copp_wait_item_t *item;
@@ -871,8 +866,7 @@ ips_eh_abort(Scsi_Cmnd * SC)
871/* NOTE: this routine is called under the io_request_lock spinlock */ 866/* NOTE: this routine is called under the io_request_lock spinlock */
872/* */ 867/* */
873/****************************************************************************/ 868/****************************************************************************/
874static int 869static int __ips_eh_reset(struct scsi_cmnd *SC)
875__ips_eh_reset(Scsi_Cmnd * SC)
876{ 870{
877 int ret; 871 int ret;
878 int i; 872 int i;
@@ -968,7 +962,7 @@ __ips_eh_reset(Scsi_Cmnd * SC)
968 ret = (*ha->func.reset) (ha); 962 ret = (*ha->func.reset) (ha);
969 963
970 if (!ret) { 964 if (!ret) {
971 Scsi_Cmnd *scsi_cmd; 965 struct scsi_cmnd *scsi_cmd;
972 966
973 IPS_PRINTK(KERN_NOTICE, ha->pcidev, 967 IPS_PRINTK(KERN_NOTICE, ha->pcidev,
974 "Controller reset failed - controller now offline.\n"); 968 "Controller reset failed - controller now offline.\n");
@@ -997,7 +991,7 @@ __ips_eh_reset(Scsi_Cmnd * SC)
997 } 991 }
998 992
999 if (!ips_clear_adapter(ha, IPS_INTR_IORL)) { 993 if (!ips_clear_adapter(ha, IPS_INTR_IORL)) {
1000 Scsi_Cmnd *scsi_cmd; 994 struct scsi_cmnd *scsi_cmd;
1001 995
1002 IPS_PRINTK(KERN_NOTICE, ha->pcidev, 996 IPS_PRINTK(KERN_NOTICE, ha->pcidev,
1003 "Controller reset failed - controller now offline.\n"); 997 "Controller reset failed - controller now offline.\n");
@@ -1059,8 +1053,7 @@ __ips_eh_reset(Scsi_Cmnd * SC)
1059 1053
1060} 1054}
1061 1055
1062static int 1056static int ips_eh_reset(struct scsi_cmnd *SC)
1063ips_eh_reset(Scsi_Cmnd * SC)
1064{ 1057{
1065 int rc; 1058 int rc;
1066 1059
@@ -1083,8 +1076,7 @@ ips_eh_reset(Scsi_Cmnd * SC)
1083/* Linux obtains io_request_lock before calling this function */ 1076/* Linux obtains io_request_lock before calling this function */
1084/* */ 1077/* */
1085/****************************************************************************/ 1078/****************************************************************************/
1086static int 1079static int ips_queue(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *))
1087ips_queue(Scsi_Cmnd * SC, void (*done) (Scsi_Cmnd *))
1088{ 1080{
1089 ips_ha_t *ha; 1081 ips_ha_t *ha;
1090 ips_passthru_t *pt; 1082 ips_passthru_t *pt;
@@ -1602,8 +1594,7 @@ ips_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset,
1602/* Determine if the specified SCSI command is really a passthru command */ 1594/* Determine if the specified SCSI command is really a passthru command */
1603/* */ 1595/* */
1604/****************************************************************************/ 1596/****************************************************************************/
1605static int 1597static int ips_is_passthru(struct scsi_cmnd *SC)
1606ips_is_passthru(Scsi_Cmnd * SC)
1607{ 1598{
1608 unsigned long flags; 1599 unsigned long flags;
1609 1600
@@ -1685,7 +1676,7 @@ ips_alloc_passthru_buffer(ips_ha_t * ha, int length)
1685/* */ 1676/* */
1686/****************************************************************************/ 1677/****************************************************************************/
1687static int 1678static int
1688ips_make_passthru(ips_ha_t * ha, Scsi_Cmnd * SC, ips_scb_t * scb, int intr) 1679ips_make_passthru(ips_ha_t *ha, struct scsi_cmnd *SC, ips_scb_t *scb, int intr)
1689{ 1680{
1690 ips_passthru_t *pt; 1681 ips_passthru_t *pt;
1691 int length = 0; 1682 int length = 0;
@@ -2734,9 +2725,9 @@ static void
2734ips_next(ips_ha_t * ha, int intr) 2725ips_next(ips_ha_t * ha, int intr)
2735{ 2726{
2736 ips_scb_t *scb; 2727 ips_scb_t *scb;
2737 Scsi_Cmnd *SC; 2728 struct scsi_cmnd *SC;
2738 Scsi_Cmnd *p; 2729 struct scsi_cmnd *p;
2739 Scsi_Cmnd *q; 2730 struct scsi_cmnd *q;
2740 ips_copp_wait_item_t *item; 2731 ips_copp_wait_item_t *item;
2741 int ret; 2732 int ret;
2742 unsigned long cpu_flags = 0; 2733 unsigned long cpu_flags = 0;
@@ -2847,7 +2838,7 @@ ips_next(ips_ha_t * ha, int intr)
2847 dcdb_active[scmd_channel(p) - 2838 dcdb_active[scmd_channel(p) -
2848 1] & (1 << scmd_id(p)))) { 2839 1] & (1 << scmd_id(p)))) {
2849 ips_freescb(ha, scb); 2840 ips_freescb(ha, scb);
2850 p = (Scsi_Cmnd *) p->host_scribble; 2841 p = (struct scsi_cmnd *) p->host_scribble;
2851 continue; 2842 continue;
2852 } 2843 }
2853 2844
@@ -2962,7 +2953,7 @@ ips_next(ips_ha_t * ha, int intr)
2962 break; 2953 break;
2963 } /* end case */ 2954 } /* end case */
2964 2955
2965 p = (Scsi_Cmnd *) p->host_scribble; 2956 p = (struct scsi_cmnd *) p->host_scribble;
2966 2957
2967 } /* end while */ 2958 } /* end while */
2968 2959
@@ -3090,8 +3081,7 @@ ips_removeq_scb(ips_scb_queue_t * queue, ips_scb_t * item)
3090/* ASSUMED to be called from within the HA lock */ 3081/* ASSUMED to be called from within the HA lock */
3091/* */ 3082/* */
3092/****************************************************************************/ 3083/****************************************************************************/
3093static void 3084static void ips_putq_wait_tail(ips_wait_queue_t *queue, struct scsi_cmnd *item)
3094ips_putq_wait_tail(ips_wait_queue_t * queue, Scsi_Cmnd * item)
3095{ 3085{
3096 METHOD_TRACE("ips_putq_wait_tail", 1); 3086 METHOD_TRACE("ips_putq_wait_tail", 1);
3097 3087
@@ -3122,10 +3112,9 @@ ips_putq_wait_tail(ips_wait_queue_t * queue, Scsi_Cmnd * item)
3122/* ASSUMED to be called from within the HA lock */ 3112/* ASSUMED to be called from within the HA lock */
3123/* */ 3113/* */
3124/****************************************************************************/ 3114/****************************************************************************/
3125static Scsi_Cmnd * 3115static struct scsi_cmnd *ips_removeq_wait_head(ips_wait_queue_t *queue)
3126ips_removeq_wait_head(ips_wait_queue_t * queue)
3127{ 3116{
3128 Scsi_Cmnd *item; 3117 struct scsi_cmnd *item;
3129 3118
3130 METHOD_TRACE("ips_removeq_wait_head", 1); 3119 METHOD_TRACE("ips_removeq_wait_head", 1);
3131 3120
@@ -3135,7 +3124,7 @@ ips_removeq_wait_head(ips_wait_queue_t * queue)
3135 return (NULL); 3124 return (NULL);
3136 } 3125 }
3137 3126
3138 queue->head = (Scsi_Cmnd *) item->host_scribble; 3127 queue->head = (struct scsi_cmnd *) item->host_scribble;
3139 item->host_scribble = NULL; 3128 item->host_scribble = NULL;
3140 3129
3141 if (queue->tail == item) 3130 if (queue->tail == item)
@@ -3157,10 +3146,10 @@ ips_removeq_wait_head(ips_wait_queue_t * queue)
3157/* ASSUMED to be called from within the HA lock */ 3146/* ASSUMED to be called from within the HA lock */
3158/* */ 3147/* */
3159/****************************************************************************/ 3148/****************************************************************************/
3160static Scsi_Cmnd * 3149static struct scsi_cmnd *ips_removeq_wait(ips_wait_queue_t *queue,
3161ips_removeq_wait(ips_wait_queue_t * queue, Scsi_Cmnd * item) 3150 struct scsi_cmnd *item)
3162{ 3151{
3163 Scsi_Cmnd *p; 3152 struct scsi_cmnd *p;
3164 3153
3165 METHOD_TRACE("ips_removeq_wait", 1); 3154 METHOD_TRACE("ips_removeq_wait", 1);
3166 3155
@@ -3173,8 +3162,8 @@ ips_removeq_wait(ips_wait_queue_t * queue, Scsi_Cmnd * item)
3173 3162
3174 p = queue->head; 3163 p = queue->head;
3175 3164
3176 while ((p) && (item != (Scsi_Cmnd *) p->host_scribble)) 3165 while ((p) && (item != (struct scsi_cmnd *) p->host_scribble))
3177 p = (Scsi_Cmnd *) p->host_scribble; 3166 p = (struct scsi_cmnd *) p->host_scribble;
3178 3167
3179 if (p) { 3168 if (p) {
3180 /* found a match */ 3169 /* found a match */
@@ -3659,11 +3648,10 @@ ips_send_wait(ips_ha_t * ha, ips_scb_t * scb, int timeout, int intr)
3659/* Routine Name: ips_scmd_buf_write */ 3648/* Routine Name: ips_scmd_buf_write */
3660/* */ 3649/* */
3661/* Routine Description: */ 3650/* Routine Description: */
3662/* Write data to Scsi_Cmnd request_buffer at proper offsets */ 3651/* Write data to struct scsi_cmnd request_buffer at proper offsets */
3663/****************************************************************************/ 3652/****************************************************************************/
3664static void 3653static void
3665ips_scmd_buf_write(Scsi_Cmnd * scmd, void *data, unsigned 3654ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count)
3666 int count)
3667{ 3655{
3668 if (scmd->use_sg) { 3656 if (scmd->use_sg) {
3669 int i; 3657 int i;
@@ -3698,11 +3686,10 @@ ips_scmd_buf_write(Scsi_Cmnd * scmd, void *data, unsigned
3698/* Routine Name: ips_scmd_buf_read */ 3686/* Routine Name: ips_scmd_buf_read */
3699/* */ 3687/* */
3700/* Routine Description: */ 3688/* Routine Description: */
3701/* Copy data from a Scsi_Cmnd to a new, linear buffer */ 3689/* Copy data from a struct scsi_cmnd to a new, linear buffer */
3702/****************************************************************************/ 3690/****************************************************************************/
3703static void 3691static void
3704ips_scmd_buf_read(Scsi_Cmnd * scmd, void *data, unsigned 3692ips_scmd_buf_read(struct scsi_cmnd *scmd, void *data, unsigned int count)
3705 int count)
3706{ 3693{
3707 if (scmd->use_sg) { 3694 if (scmd->use_sg) {
3708 int i; 3695 int i;
@@ -7078,7 +7065,7 @@ ips_remove_device(struct pci_dev *pci_dev)
7078static int __init 7065static int __init
7079ips_module_init(void) 7066ips_module_init(void)
7080{ 7067{
7081 if (pci_module_init(&ips_pci_driver) < 0) 7068 if (pci_register_driver(&ips_pci_driver) < 0)
7082 return -ENODEV; 7069 return -ENODEV;
7083 ips_driver_template.module = THIS_MODULE; 7070 ips_driver_template.module = THIS_MODULE;
7084 ips_order_controllers(); 7071 ips_order_controllers();