aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2008-04-03 16:13:20 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:19:14 -0400
commit587f4cae4a8ce1315c3def2229c2a912637269b6 (patch)
treec2657826cd5be8f28dcdc5a3adbe60b1ccbbf149
parentcb8dacbf1110d8bd39413f3116ff1720f757854e (diff)
[SCSI] qla2xxx: Cruft cleanup of functions and structures.
Strip unused (DEBUG-ONLY) enabled functions, inlines, useless wrappers, and unused DPC flags from the code. Another step in the migration towards a cleaner (less-crusty) driver. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c122
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.h13
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_gs.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c41
-rw-r--r--drivers/scsi/qla2xxx/qla_inline.h85
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c90
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c62
11 files changed, 2 insertions, 428 deletions
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 83dd68bacf2a..9d12d9f26209 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -1410,125 +1410,3 @@ qla2x00_dump_buffer(uint8_t * b, uint32_t size)
1410 if (cnt % 16) 1410 if (cnt % 16)
1411 printk("\n"); 1411 printk("\n");
1412} 1412}
1413
1414/**************************************************************************
1415 * qla2x00_print_scsi_cmd
1416 * Dumps out info about the scsi cmd and srb.
1417 * Input
1418 * cmd : struct scsi_cmnd
1419 **************************************************************************/
1420void
1421qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
1422{
1423 int i;
1424 struct scsi_qla_host *ha;
1425 srb_t *sp;
1426
1427 ha = shost_priv(cmd->device->host);
1428
1429 sp = (srb_t *) cmd->SCp.ptr;
1430 printk("SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble);
1431 printk(" chan=0x%02x, target=0x%02x, lun=0x%02x, cmd_len=0x%02x\n",
1432 cmd->device->channel, cmd->device->id, cmd->device->lun,
1433 cmd->cmd_len);
1434 printk(" CDB: ");
1435 for (i = 0; i < cmd->cmd_len; i++) {
1436 printk("0x%02x ", cmd->cmnd[i]);
1437 }
1438 printk("\n seg_cnt=%d, allowed=%d, retries=%d\n",
1439 scsi_sg_count(cmd), cmd->allowed, cmd->retries);
1440 printk(" request buffer=0x%p, request buffer len=0x%x\n",
1441 scsi_sglist(cmd), scsi_bufflen(cmd));
1442 printk(" tag=%d, transfersize=0x%x\n",
1443 cmd->tag, cmd->transfersize);
1444 printk(" serial_number=%lx, SP=%p\n", cmd->serial_number, sp);
1445 printk(" data direction=%d\n", cmd->sc_data_direction);
1446
1447 if (!sp)
1448 return;
1449
1450 printk(" sp flags=0x%x\n", sp->flags);
1451}
1452
1453#if defined(QL_DEBUG_ROUTINES)
1454/*
1455 * qla2x00_formatted_dump_buffer
1456 * Prints string plus buffer.
1457 *
1458 * Input:
1459 * string = Null terminated string (no newline at end).
1460 * buffer = buffer address.
1461 * wd_size = word size 8, 16, 32 or 64 bits
1462 * count = number of words.
1463 */
1464void
1465qla2x00_formatted_dump_buffer(char *string, uint8_t * buffer,
1466 uint8_t wd_size, uint32_t count)
1467{
1468 uint32_t cnt;
1469 uint16_t *buf16;
1470 uint32_t *buf32;
1471
1472 if (strcmp(string, "") != 0)
1473 printk("%s\n",string);
1474
1475 switch (wd_size) {
1476 case 8:
1477 printk(" 0 1 2 3 4 5 6 7 "
1478 "8 9 Ah Bh Ch Dh Eh Fh\n");
1479 printk("-----------------------------------------"
1480 "-------------------------------------\n");
1481
1482 for (cnt = 1; cnt <= count; cnt++, buffer++) {
1483 printk("%02x",*buffer);
1484 if (cnt % 16 == 0)
1485 printk("\n");
1486 else
1487 printk(" ");
1488 }
1489 if (cnt % 16 != 0)
1490 printk("\n");
1491 break;
1492 case 16:
1493 printk(" 0 2 4 6 8 Ah "
1494 " Ch Eh\n");
1495 printk("-----------------------------------------"
1496 "-------------\n");
1497
1498 buf16 = (uint16_t *) buffer;
1499 for (cnt = 1; cnt <= count; cnt++, buf16++) {
1500 printk("%4x",*buf16);
1501
1502 if (cnt % 8 == 0)
1503 printk("\n");
1504 else if (*buf16 < 10)
1505 printk(" ");
1506 else
1507 printk(" ");
1508 }
1509 if (cnt % 8 != 0)
1510 printk("\n");
1511 break;
1512 case 32:
1513 printk(" 0 4 8 Ch\n");
1514 printk("------------------------------------------\n");
1515
1516 buf32 = (uint32_t *) buffer;
1517 for (cnt = 1; cnt <= count; cnt++, buf32++) {
1518 printk("%8x", *buf32);
1519
1520 if (cnt % 4 == 0)
1521 printk("\n");
1522 else if (*buf32 < 10)
1523 printk(" ");
1524 else
1525 printk(" ");
1526 }
1527 if (cnt % 4 != 0)
1528 printk("\n");
1529 break;
1530 default:
1531 break;
1532 }
1533}
1534#endif
diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h
index c30f2fa284f2..2a4043b5b145 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.h
+++ b/drivers/scsi/qla2xxx/qla_dbg.h
@@ -22,19 +22,6 @@
22/* #define QL_DEBUG_LEVEL_13 */ /* Output fdmi function trace msgs */ 22/* #define QL_DEBUG_LEVEL_13 */ /* Output fdmi function trace msgs */
23/* #define QL_DEBUG_LEVEL_14 */ /* Output RSCN trace msgs */ 23/* #define QL_DEBUG_LEVEL_14 */ /* Output RSCN trace msgs */
24/* #define QL_DEBUG_LEVEL_15 */ /* Output NPIV trace msgs */ 24/* #define QL_DEBUG_LEVEL_15 */ /* Output NPIV trace msgs */
25/*
26 * Local Macro Definitions.
27 */
28#if defined(QL_DEBUG_LEVEL_1) || defined(QL_DEBUG_LEVEL_2) || \
29 defined(QL_DEBUG_LEVEL_3) || defined(QL_DEBUG_LEVEL_4) || \
30 defined(QL_DEBUG_LEVEL_5) || defined(QL_DEBUG_LEVEL_6) || \
31 defined(QL_DEBUG_LEVEL_7) || defined(QL_DEBUG_LEVEL_8) || \
32 defined(QL_DEBUG_LEVEL_9) || defined(QL_DEBUG_LEVEL_10) || \
33 defined(QL_DEBUG_LEVEL_11) || defined(QL_DEBUG_LEVEL_12) || \
34 defined(QL_DEBUG_LEVEL_13) || defined(QL_DEBUG_LEVEL_14) || \
35 defined(QL_DEBUG_LEVEL_15)
36 #define QL_DEBUG_ROUTINES
37#endif
38 25
39/* 26/*
40* Macros use for debugging the driver. 27* Macros use for debugging the driver.
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 13ffedaf8cba..047973f37847 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2449,8 +2449,6 @@ typedef struct scsi_qla_host {
2449#define MBX_TIMEDOUT BIT_5 2449#define MBX_TIMEDOUT BIT_5
2450#define MBX_ACCESS_TIMEDOUT BIT_6 2450#define MBX_ACCESS_TIMEDOUT BIT_6
2451 2451
2452 mbx_cmd_t mc;
2453
2454 /* Basic firmware related information. */ 2452 /* Basic firmware related information. */
2455 uint16_t fw_major_version; 2453 uint16_t fw_major_version;
2456 uint16_t fw_minor_version; 2454 uint16_t fw_minor_version;
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 276bd26c0c8e..10c3f905b711 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -38,9 +38,6 @@ extern int qla2x00_loop_resync(scsi_qla_host_t *);
38extern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *); 38extern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *);
39extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *); 39extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *);
40 40
41extern void qla2x00_restart_queues(scsi_qla_host_t *, uint8_t);
42
43extern void qla2x00_rescan_fcports(scsi_qla_host_t *);
44extern void qla2x00_update_fcports(scsi_qla_host_t *); 41extern void qla2x00_update_fcports(scsi_qla_host_t *);
45 42
46extern int qla2x00_abort_isp(scsi_qla_host_t *); 43extern int qla2x00_abort_isp(scsi_qla_host_t *);
@@ -312,7 +309,6 @@ extern void qla24xx_fw_dump(scsi_qla_host_t *, int);
312extern void qla25xx_fw_dump(scsi_qla_host_t *, int); 309extern void qla25xx_fw_dump(scsi_qla_host_t *, int);
313extern void qla2x00_dump_regs(scsi_qla_host_t *); 310extern void qla2x00_dump_regs(scsi_qla_host_t *);
314extern void qla2x00_dump_buffer(uint8_t *, uint32_t); 311extern void qla2x00_dump_buffer(uint8_t *, uint32_t);
315extern void qla2x00_print_scsi_cmd(struct scsi_cmnd *);
316 312
317/* 313/*
318 * Global Function Prototypes in qla_gs.c source file. 314 * Global Function Prototypes in qla_gs.c source file.
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index ea8a7d3e9ce5..e6578ce34ecd 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -6,12 +6,6 @@
6 */ 6 */
7#include "qla_def.h" 7#include "qla_def.h"
8 8
9static inline struct ct_sns_req *
10qla2x00_prep_ct_req(struct ct_sns_req *, uint16_t, uint16_t);
11
12static inline struct sns_cmd_pkt *
13qla2x00_prep_sns_cmd(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t);
14
15static int qla2x00_sns_ga_nxt(scsi_qla_host_t *, fc_port_t *); 9static int qla2x00_sns_ga_nxt(scsi_qla_host_t *, fc_port_t *);
16static int qla2x00_sns_gid_pt(scsi_qla_host_t *, sw_info_t *); 10static int qla2x00_sns_gid_pt(scsi_qla_host_t *, sw_info_t *);
17static int qla2x00_sns_gpn_id(scsi_qla_host_t *, sw_info_t *); 11static int qla2x00_sns_gpn_id(scsi_qla_host_t *, sw_info_t *);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index e9a7c2d13855..d429e2f5c70e 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -15,14 +15,6 @@
15#include <asm/prom.h> 15#include <asm/prom.h>
16#endif 16#endif
17 17
18/* XXX(hch): this is ugly, but we don't want to pull in exioctl.h */
19#ifndef EXT_IS_LUN_BIT_SET
20#define EXT_IS_LUN_BIT_SET(P,L) \
21 (((P)->mask[L/8] & (0x80 >> (L%8)))?1:0)
22#define EXT_SET_LUN_BIT(P,L) \
23 ((P)->mask[L/8] |= (0x80 >> (L%8)))
24#endif
25
26/* 18/*
27* QLogic ISP2x00 Hardware Support Function Prototypes. 19* QLogic ISP2x00 Hardware Support Function Prototypes.
28*/ 20*/
@@ -2176,20 +2168,6 @@ cleanup_allocation:
2176} 2168}
2177 2169
2178static void 2170static void
2179qla2x00_probe_for_all_luns(scsi_qla_host_t *ha)
2180{
2181 fc_port_t *fcport;
2182
2183 qla2x00_mark_all_devices_lost(ha, 0);
2184 list_for_each_entry(fcport, &ha->fcports, list) {
2185 if (fcport->port_type != FCT_TARGET)
2186 continue;
2187
2188 qla2x00_update_fcport(ha, fcport);
2189 }
2190}
2191
2192static void
2193qla2x00_iidma_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) 2171qla2x00_iidma_fcport(scsi_qla_host_t *ha, fc_port_t *fcport)
2194{ 2172{
2195#define LS_UNKNOWN 2 2173#define LS_UNKNOWN 2
@@ -3200,25 +3178,6 @@ qla2x00_loop_resync(scsi_qla_host_t *ha)
3200} 3178}
3201 3179
3202void 3180void
3203qla2x00_rescan_fcports(scsi_qla_host_t *ha)
3204{
3205 int rescan_done;
3206 fc_port_t *fcport;
3207
3208 rescan_done = 0;
3209 list_for_each_entry(fcport, &ha->fcports, list) {
3210 if ((fcport->flags & FCF_RESCAN_NEEDED) == 0)
3211 continue;
3212
3213 qla2x00_update_fcport(ha, fcport);
3214 fcport->flags &= ~FCF_RESCAN_NEEDED;
3215
3216 rescan_done = 1;
3217 }
3218 qla2x00_probe_for_all_luns(ha);
3219}
3220
3221void
3222qla2x00_update_fcports(scsi_qla_host_t *ha) 3181qla2x00_update_fcports(scsi_qla_host_t *ha)
3223{ 3182{
3224 fc_port_t *fcport; 3183 fc_port_t *fcport;
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h
index 3e57a3e03dac..e9bae27737d1 100644
--- a/drivers/scsi/qla2xxx/qla_inline.h
+++ b/drivers/scsi/qla2xxx/qla_inline.h
@@ -5,7 +5,6 @@
5 * See LICENSE.qla2xxx for copyright and licensing details. 5 * See LICENSE.qla2xxx for copyright and licensing details.
6 */ 6 */
7 7
8static __inline__ uint16_t qla2x00_debounce_register(volatile uint16_t __iomem *);
9/* 8/*
10 * qla2x00_debounce_register 9 * qla2x00_debounce_register
11 * Debounce register. 10 * Debounce register.
@@ -32,94 +31,12 @@ qla2x00_debounce_register(volatile uint16_t __iomem *addr)
32 return (first); 31 return (first);
33} 32}
34 33
35static __inline__ int qla2x00_normalize_dma_addr(
36 dma_addr_t *e_addr, uint32_t *e_len,
37 dma_addr_t *ne_addr, uint32_t *ne_len);
38
39/**
40 * qla2x00_normalize_dma_addr() - Normalize an DMA address.
41 * @e_addr: Raw DMA address
42 * @e_len: Raw DMA length
43 * @ne_addr: Normalized second DMA address
44 * @ne_len: Normalized second DMA length
45 *
46 * If the address does not span a 4GB page boundary, the contents of @ne_addr
47 * and @ne_len are undefined. @e_len is updated to reflect a normalization.
48 *
49 * Example:
50 *
51 * ffffabc0ffffeeee (e_addr) start of DMA address
52 * 0000000020000000 (e_len) length of DMA transfer
53 * ffffabc11fffeeed end of DMA transfer
54 *
55 * Is the 4GB boundary crossed?
56 *
57 * ffffabc0ffffeeee (e_addr)
58 * ffffabc11fffeeed (e_addr + e_len - 1)
59 * 00000001e0000003 ((e_addr ^ (e_addr + e_len - 1))
60 * 0000000100000000 ((e_addr ^ (e_addr + e_len - 1)) & ~(0xffffffff)
61 *
62 * Compute start of second DMA segment:
63 *
64 * ffffabc0ffffeeee (e_addr)
65 * ffffabc1ffffeeee (0x100000000 + e_addr)
66 * ffffabc100000000 (0x100000000 + e_addr) & ~(0xffffffff)
67 * ffffabc100000000 (ne_addr)
68 *
69 * Compute length of second DMA segment:
70 *
71 * 00000000ffffeeee (e_addr & 0xffffffff)
72 * 0000000000001112 (0x100000000 - (e_addr & 0xffffffff))
73 * 000000001fffeeee (e_len - (0x100000000 - (e_addr & 0xffffffff))
74 * 000000001fffeeee (ne_len)
75 *
76 * Adjust length of first DMA segment
77 *
78 * 0000000020000000 (e_len)
79 * 0000000000001112 (e_len - ne_len)
80 * 0000000000001112 (e_len)
81 *
82 * Returns non-zero if the specified address was normalized, else zero.
83 */
84static __inline__ int
85qla2x00_normalize_dma_addr(
86 dma_addr_t *e_addr, uint32_t *e_len,
87 dma_addr_t *ne_addr, uint32_t *ne_len)
88{
89 int normalized;
90
91 normalized = 0;
92 if ((*e_addr ^ (*e_addr + *e_len - 1)) & ~(0xFFFFFFFFULL)) {
93 /* Compute normalized crossed address and len */
94 *ne_addr = (0x100000000ULL + *e_addr) & ~(0xFFFFFFFFULL);
95 *ne_len = *e_len - (0x100000000ULL - (*e_addr & 0xFFFFFFFFULL));
96 *e_len -= *ne_len;
97
98 normalized++;
99 }
100 return (normalized);
101}
102
103static __inline__ void qla2x00_poll(scsi_qla_host_t *);
104static inline void 34static inline void
105qla2x00_poll(scsi_qla_host_t *ha) 35qla2x00_poll(scsi_qla_host_t *ha)
106{ 36{
107 ha->isp_ops->intr_handler(0, ha); 37 ha->isp_ops->intr_handler(0, ha);
108} 38}
109 39
110static __inline__ void qla2x00_check_fabric_devices(scsi_qla_host_t *);
111/*
112 * This routine will wait for fabric devices for
113 * the reset delay.
114 */
115static __inline__ void qla2x00_check_fabric_devices(scsi_qla_host_t *ha)
116{
117 uint16_t fw_state;
118
119 qla2x00_get_firmware_state(ha, &fw_state);
120}
121
122static __inline__ scsi_qla_host_t * to_qla_parent(scsi_qla_host_t *);
123static __inline__ scsi_qla_host_t * 40static __inline__ scsi_qla_host_t *
124to_qla_parent(scsi_qla_host_t *ha) 41to_qla_parent(scsi_qla_host_t *ha)
125{ 42{
@@ -152,7 +69,6 @@ qla2x00_issue_marker(scsi_qla_host_t *ha, int ha_locked)
152 return (QLA_SUCCESS); 69 return (QLA_SUCCESS);
153} 70}
154 71
155static inline uint8_t *host_to_fcp_swap(uint8_t *, uint32_t);
156static inline uint8_t * 72static inline uint8_t *
157host_to_fcp_swap(uint8_t *fcp, uint32_t bsize) 73host_to_fcp_swap(uint8_t *fcp, uint32_t bsize)
158{ 74{
@@ -166,7 +82,6 @@ host_to_fcp_swap(uint8_t *fcp, uint32_t bsize)
166 return fcp; 82 return fcp;
167} 83}
168 84
169static inline int qla2x00_is_reserved_id(scsi_qla_host_t *, uint16_t);
170static inline int 85static inline int
171qla2x00_is_reserved_id(scsi_qla_host_t *ha, uint16_t loop_id) 86qla2x00_is_reserved_id(scsi_qla_host_t *ha, uint16_t loop_id)
172{ 87{
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 9192ad574d99..5489d5024673 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -11,9 +11,6 @@
11 11
12#include <scsi/scsi_tcq.h> 12#include <scsi/scsi_tcq.h>
13 13
14static inline uint16_t qla2x00_get_cmd_direction(struct scsi_cmnd *cmd);
15static inline cont_entry_t *qla2x00_prep_cont_type0_iocb(scsi_qla_host_t *);
16static inline cont_a64_entry_t *qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *);
17static request_t *qla2x00_req_pkt(scsi_qla_host_t *ha); 14static request_t *qla2x00_req_pkt(scsi_qla_host_t *ha);
18static void qla2x00_isp_cmd(scsi_qla_host_t *ha); 15static void qla2x00_isp_cmd(scsi_qla_host_t *ha);
19 16
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 088464251d7e..e88600082c01 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -14,9 +14,6 @@ static void qla2x00_process_completed_request(struct scsi_qla_host *, uint32_t);
14static void qla2x00_status_entry(scsi_qla_host_t *, void *); 14static void qla2x00_status_entry(scsi_qla_host_t *, void *);
15static void qla2x00_status_cont_entry(scsi_qla_host_t *, sts_cont_entry_t *); 15static void qla2x00_status_cont_entry(scsi_qla_host_t *, sts_cont_entry_t *);
16static void qla2x00_error_entry(scsi_qla_host_t *, sts_entry_t *); 16static void qla2x00_error_entry(scsi_qla_host_t *, sts_entry_t *);
17static void qla2x00_ms_entry(scsi_qla_host_t *, ms_iocb_entry_t *);
18
19static void qla24xx_ms_entry(scsi_qla_host_t *, struct ct_entry_24xx *);
20 17
21/** 18/**
22 * qla2100_intr_handler() - Process interrupts for the ISP2100 and ISP2200. 19 * qla2100_intr_handler() - Process interrupts for the ISP2100 and ISP2200.
@@ -809,9 +806,6 @@ qla2x00_process_response_queue(struct scsi_qla_host *ha)
809 case STATUS_CONT_TYPE: 806 case STATUS_CONT_TYPE:
810 qla2x00_status_cont_entry(ha, (sts_cont_entry_t *)pkt); 807 qla2x00_status_cont_entry(ha, (sts_cont_entry_t *)pkt);
811 break; 808 break;
812 case MS_IOCB_TYPE:
813 qla2x00_ms_entry(ha, (ms_iocb_entry_t *)pkt);
814 break;
815 default: 809 default:
816 /* Type Not Supported. */ 810 /* Type Not Supported. */
817 DEBUG4(printk(KERN_WARNING 811 DEBUG4(printk(KERN_WARNING
@@ -1346,44 +1340,6 @@ qla2x00_error_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
1346} 1340}
1347 1341
1348/** 1342/**
1349 * qla2x00_ms_entry() - Process a Management Server entry.
1350 * @ha: SCSI driver HA context
1351 * @index: Response queue out pointer
1352 */
1353static void
1354qla2x00_ms_entry(scsi_qla_host_t *ha, ms_iocb_entry_t *pkt)
1355{
1356 srb_t *sp;
1357
1358 DEBUG3(printk("%s(%ld): pkt=%p pkthandle=%d.\n",
1359 __func__, ha->host_no, pkt, pkt->handle1));
1360
1361 /* Validate handle. */
1362 if (pkt->handle1 < MAX_OUTSTANDING_COMMANDS)
1363 sp = ha->outstanding_cmds[pkt->handle1];
1364 else
1365 sp = NULL;
1366
1367 if (sp == NULL) {
1368 DEBUG2(printk("scsi(%ld): MS entry - invalid handle\n",
1369 ha->host_no));
1370 qla_printk(KERN_WARNING, ha, "MS entry - invalid handle\n");
1371
1372 set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
1373 return;
1374 }
1375
1376 CMD_COMPL_STATUS(sp->cmd) = le16_to_cpu(pkt->status);
1377 CMD_ENTRY_STATUS(sp->cmd) = pkt->entry_status;
1378
1379 /* Free outstanding command slot. */
1380 ha->outstanding_cmds[pkt->handle1] = NULL;
1381
1382 qla2x00_sp_compl(ha, sp);
1383}
1384
1385
1386/**
1387 * qla24xx_mbx_completion() - Process mailbox command completions. 1343 * qla24xx_mbx_completion() - Process mailbox command completions.
1388 * @ha: SCSI driver HA context 1344 * @ha: SCSI driver HA context
1389 * @mb0: Mailbox0 register 1345 * @mb0: Mailbox0 register
@@ -1455,9 +1411,6 @@ qla24xx_process_response_queue(struct scsi_qla_host *ha)
1455 case STATUS_CONT_TYPE: 1411 case STATUS_CONT_TYPE:
1456 qla2x00_status_cont_entry(ha, (sts_cont_entry_t *)pkt); 1412 qla2x00_status_cont_entry(ha, (sts_cont_entry_t *)pkt);
1457 break; 1413 break;
1458 case MS_IOCB_TYPE:
1459 qla24xx_ms_entry(ha, (struct ct_entry_24xx *)pkt);
1460 break;
1461 case VP_RPT_ID_IOCB_TYPE: 1414 case VP_RPT_ID_IOCB_TYPE:
1462 qla24xx_report_id_acquisition(ha, 1415 qla24xx_report_id_acquisition(ha,
1463 (struct vp_rpt_id_entry_24xx *)pkt); 1416 (struct vp_rpt_id_entry_24xx *)pkt);
@@ -1619,49 +1572,6 @@ qla24xx_intr_handler(int irq, void *dev_id)
1619 return IRQ_HANDLED; 1572 return IRQ_HANDLED;
1620} 1573}
1621 1574
1622/**
1623 * qla24xx_ms_entry() - Process a Management Server entry.
1624 * @ha: SCSI driver HA context
1625 * @index: Response queue out pointer
1626 */
1627static void
1628qla24xx_ms_entry(scsi_qla_host_t *ha, struct ct_entry_24xx *pkt)
1629{
1630 srb_t *sp;
1631
1632 DEBUG3(printk("%s(%ld): pkt=%p pkthandle=%d.\n",
1633 __func__, ha->host_no, pkt, pkt->handle));
1634
1635 DEBUG9(printk("%s: ct pkt dump:\n", __func__));
1636 DEBUG9(qla2x00_dump_buffer((void *)pkt, sizeof(struct ct_entry_24xx)));
1637
1638 /* Validate handle. */
1639 if (pkt->handle < MAX_OUTSTANDING_COMMANDS)
1640 sp = ha->outstanding_cmds[pkt->handle];
1641 else
1642 sp = NULL;
1643
1644 if (sp == NULL) {
1645 DEBUG2(printk("scsi(%ld): MS entry - invalid handle\n",
1646 ha->host_no));
1647 DEBUG10(printk("scsi(%ld): MS entry - invalid handle\n",
1648 ha->host_no));
1649 qla_printk(KERN_WARNING, ha, "MS entry - invalid handle %d\n",
1650 pkt->handle);
1651
1652 set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
1653 return;
1654 }
1655
1656 CMD_COMPL_STATUS(sp->cmd) = le16_to_cpu(pkt->comp_status);
1657 CMD_ENTRY_STATUS(sp->cmd) = pkt->entry_status;
1658
1659 /* Free outstanding command slot. */
1660 ha->outstanding_cmds[pkt->handle] = NULL;
1661
1662 qla2x00_sp_compl(ha, sp);
1663}
1664
1665static irqreturn_t 1575static irqreturn_t
1666qla24xx_msix_rsp_q(int irq, void *dev_id) 1576qla24xx_msix_rsp_q(int irq, void *dev_id)
1667{ 1577{
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index 5305ec194239..9f48cd46f618 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -16,8 +16,6 @@
16#include <scsi/scsicam.h> 16#include <scsi/scsicam.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18 18
19void qla2x00_vp_stop_timer(scsi_qla_host_t *);
20
21void 19void
22qla2x00_vp_stop_timer(scsi_qla_host_t *vha) 20qla2x00_vp_stop_timer(scsi_qla_host_t *vha)
23{ 21{
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 3d290417bfc6..c0f6f66c358f 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -26,9 +26,6 @@ char qla2x00_version_str[40];
26 */ 26 */
27static struct kmem_cache *srb_cachep; 27static struct kmem_cache *srb_cachep;
28 28
29/*
30 * Ioctl related information.
31 */
32int num_hosts; 29int num_hosts;
33int ql2xlogintimeout = 20; 30int ql2xlogintimeout = 20;
34module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR); 31module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR);
@@ -105,7 +102,6 @@ static int qla2xxx_eh_abort(struct scsi_cmnd *);
105static int qla2xxx_eh_device_reset(struct scsi_cmnd *); 102static int qla2xxx_eh_device_reset(struct scsi_cmnd *);
106static int qla2xxx_eh_bus_reset(struct scsi_cmnd *); 103static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
107static int qla2xxx_eh_host_reset(struct scsi_cmnd *); 104static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
108static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *);
109 105
110static int qla2x00_change_queue_depth(struct scsi_device *, int); 106static int qla2x00_change_queue_depth(struct scsi_device *, int);
111static int qla2x00_change_queue_type(struct scsi_device *, int); 107static int qla2x00_change_queue_type(struct scsi_device *, int);
@@ -685,7 +681,6 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
685 681
686 DEBUG2(printk("%s(%ld): aborting sp %p from RISC. pid=%ld.\n", 682 DEBUG2(printk("%s(%ld): aborting sp %p from RISC. pid=%ld.\n",
687 __func__, ha->host_no, sp, serial)); 683 __func__, ha->host_no, sp, serial));
688 DEBUG3(qla2x00_print_scsi_cmd(cmd));
689 684
690 spin_unlock_irqrestore(&pha->hardware_lock, flags); 685 spin_unlock_irqrestore(&pha->hardware_lock, flags);
691 if (ha->isp_ops->abort_command(ha, sp)) { 686 if (ha->isp_ops->abort_command(ha, sp)) {
@@ -814,7 +809,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
814 goto eh_dev_reset_done; 809 goto eh_dev_reset_done;
815 810
816 if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) { 811 if (qla2x00_wait_for_loop_ready(ha) == QLA_SUCCESS) {
817 if (qla2x00_device_reset(ha, fcport) == 0) 812 if (ha->isp_ops->abort_target(fcport) == 0)
818 ret = SUCCESS; 813 ret = SUCCESS;
819 } else { 814 } else {
820 DEBUG2(printk(KERN_INFO 815 DEBUG2(printk(KERN_INFO
@@ -1071,7 +1066,7 @@ qla2x00_loop_reset(scsi_qla_host_t *ha)
1071 if (fcport->port_type != FCT_TARGET) 1066 if (fcport->port_type != FCT_TARGET)
1072 continue; 1067 continue;
1073 1068
1074 ret = qla2x00_device_reset(ha, fcport); 1069 ret = ha->isp_ops->abort_target(fcport);
1075 if (ret != QLA_SUCCESS) { 1070 if (ret != QLA_SUCCESS) {
1076 DEBUG2_3(printk("%s(%ld): bus_reset failed: " 1071 DEBUG2_3(printk("%s(%ld): bus_reset failed: "
1077 "target_reset=%d d_id=%x.\n", __func__, 1072 "target_reset=%d d_id=%x.\n", __func__,
@@ -1086,26 +1081,6 @@ qla2x00_loop_reset(scsi_qla_host_t *ha)
1086 return QLA_SUCCESS; 1081 return QLA_SUCCESS;
1087} 1082}
1088 1083
1089/*
1090 * qla2x00_device_reset
1091 * Issue bus device reset message to the target.
1092 *
1093 * Input:
1094 * ha = adapter block pointer.
1095 * t = SCSI ID.
1096 * TARGET_QUEUE_LOCK must be released.
1097 * ADAPTER_STATE_LOCK must be released.
1098 *
1099 * Context:
1100 * Kernel context.
1101 */
1102static int
1103qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport)
1104{
1105 /* Abort Target command will clear Reservation */
1106 return ha->isp_ops->abort_target(reset_fcport);
1107}
1108
1109void 1084void
1110qla2x00_abort_all_cmds(scsi_qla_host_t *ha, int res) 1085qla2x00_abort_all_cmds(scsi_qla_host_t *ha, int res)
1111{ 1086{
@@ -2378,12 +2353,6 @@ qla2x00_do_dpc(void *data)
2378 if (test_and_clear_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags)) 2353 if (test_and_clear_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags))
2379 qla2x00_update_fcports(ha); 2354 qla2x00_update_fcports(ha);
2380 2355
2381 if (test_and_clear_bit(LOOP_RESET_NEEDED, &ha->dpc_flags)) {
2382 DEBUG(printk("scsi(%ld): dpc: sched loop_reset()\n",
2383 ha->host_no));
2384 qla2x00_loop_reset(ha);
2385 }
2386
2387 if (test_and_clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) && 2356 if (test_and_clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) &&
2388 (!(test_and_set_bit(RESET_ACTIVE, &ha->dpc_flags)))) { 2357 (!(test_and_set_bit(RESET_ACTIVE, &ha->dpc_flags)))) {
2389 2358
@@ -2454,19 +2423,6 @@ qla2x00_do_dpc(void *data)
2454 ha->host_no)); 2423 ha->host_no));
2455 } 2424 }
2456 2425
2457 if ((test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags)) &&
2458 atomic_read(&ha->loop_state) != LOOP_DOWN) {
2459
2460 clear_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags);
2461 DEBUG(printk("scsi(%ld): qla2x00_login_retry()\n",
2462 ha->host_no));
2463
2464 set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
2465
2466 DEBUG(printk("scsi(%ld): qla2x00_login_retry - end\n",
2467 ha->host_no));
2468 }
2469
2470 if (test_and_clear_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) { 2426 if (test_and_clear_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) {
2471 2427
2472 DEBUG(printk("scsi(%ld): qla2x00_loop_resync()\n", 2428 DEBUG(printk("scsi(%ld): qla2x00_loop_resync()\n",
@@ -2484,18 +2440,6 @@ qla2x00_do_dpc(void *data)
2484 ha->host_no)); 2440 ha->host_no));
2485 } 2441 }
2486 2442
2487 if (test_and_clear_bit(FCPORT_RESCAN_NEEDED, &ha->dpc_flags)) {
2488
2489 DEBUG(printk("scsi(%ld): Rescan flagged fcports...\n",
2490 ha->host_no));
2491
2492 qla2x00_rescan_fcports(ha);
2493
2494 DEBUG(printk("scsi(%ld): Rescan flagged fcports..."
2495 "end.\n",
2496 ha->host_no));
2497 }
2498
2499 if (!ha->interrupts_on) 2443 if (!ha->interrupts_on)
2500 ha->isp_ops->enable_intrs(ha); 2444 ha->isp_ops->enable_intrs(ha);
2501 2445
@@ -2697,10 +2641,8 @@ qla2x00_timer(scsi_qla_host_t *ha)
2697 /* Schedule the DPC routine if needed */ 2641 /* Schedule the DPC routine if needed */
2698 if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || 2642 if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
2699 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || 2643 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) ||
2700 test_bit(LOOP_RESET_NEEDED, &ha->dpc_flags) ||
2701 test_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags) || 2644 test_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags) ||
2702 start_dpc || 2645 start_dpc ||
2703 test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) ||
2704 test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) || 2646 test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) ||
2705 test_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags) || 2647 test_bit(BEACON_BLINK_NEEDED, &ha->dpc_flags) ||
2706 test_bit(VP_DPC_NEEDED, &ha->dpc_flags) || 2648 test_bit(VP_DPC_NEEDED, &ha->dpc_flags) ||